New Members: Be sure to confirm your email address by clicking on the link that was sent to your email inbox. You will not be able to post messages until you click that link.

I need help with a 52-week low scan

I'm trying to create a scan where a stock makes a 52-week low and then the price makes a series of higher highs and higher lows for anywhere from 3 to 7 days.

I've spent about an hour on this and I just can't figure it out.

Thanks in advance.

[type=stock]
and [country is US]
and [[[today's low < yesterday's daily min(253,low)]
and [[4 days ago high = 4 days ago max(251,high)]
and [Streak Down(high) = 3]]
or
[[5 days ago high = 5 days ago max(251,high)]
and [Streak Down(high) = 4]]
or
[[6 days ago high = 6 days ago max(251,high)]
and [Streak Down(high) = 5]]
or
[[7 days ago high = 7 days ago max(251,high)]
and [Streak Down(high) = 6]]
or
[[8 days ago high = 8 days ago max(251,high)]
and [Streak Down(high) = 7]] ]

and [Low > 25.00]
and [Volume > 500,000]]

Best Answers

  • lmkwinlmkwin ✭✭
    Accepted Answer
    if you put a double slash in front of the filter, the scan engine ignores the line.

    //and [Low > 25.00]
    //and [Volume > 500,000]

    are ignored

    min 251, low is the lowest low in the last 251 days
  • lmkwinlmkwin ✭✭
    Accepted Answer
    There is a section called Trading Strategies. When you post you have to select an area for your post. That one has many trading strategies, and discussions of them, on it.
  • markdmarkd mod
    Accepted Answer
    You could post it as the next comment on this thread, or start a new one under this subject area (Scanning) or maybe Using Technical Analysis.

Answers

  • markdmarkd mod
    edited November 8
    You want to test for a min 251 low (low = min(251,low) eight days ago, then a streak UP (not down) for both highs and lows for seven days or six days or five days, etc. The streaks go in an or statement after the test for min low.

    Then you want to test for a min 251 low seven days ago and streaks up for six, five, four, etc. days ago.

    Then min 251 low for 5 days ago, etc.

    All wrapped in big, nested "or" statement.

    You should probably start by writing separate scans for each case. When you get each one working, you can copy and paste into the complete scan - which will have the top level "or" statement for each day - and you will copy each case into an "or" for that day.
  • It's all Greek to me.

    The only benefit so far is I am accidentally coming up with some great LONG scans. lol

    Is this correct? It doesn't work.

    and [ [[4 days ago high = 4 days ago max(251,low)]
    and [Streak up(high) = 3]]
    or
    [[5 days ago high = 5 days ago max(251,low)]
    and [Streak up(high) = 4]]
  • Don't you want 4 days ago LOW to equal 4 days ago MIN(251,low)?

    Think about what things mean - a good way to do that is to write the scan in plain english first.
  • Like this?

    and [ [[4 days ago high = 4 days ago min(251,low)]
    and [Streak up(high) = 3]]
    or
    [[5 days ago high = 5 days ago min(251,low)]
    and [Streak up(high) = 4]]
    or
    [[6 days ago high = 6 days ago min(251,low)]
    and [Streak up(high) = 5]]
    or
    [[7 days ago high = 7 days ago min(251,low)]
    and [Streak up(high) = 6]]
    or
    [[8 days ago high = 8 days ago min(251,low)]
    and [Streak up(high) = 7]] ]
  • markdmarkd mod
    edited November 9
    not 4 days ago high = 4 days ago min(251,low)

    (the high of 4 days ago is unlikely to equal the low 4 days ago)

    but 4 days ago low = 4 days ago min(251,low)

    That says the low 4 days ago was the lowest low of the past 251 daily bars, as of 4 days ago.

    Is that what you want? or something else?
  • I want the opposite of the other 'long' scan you helped me with.
    By the way, that scan has been very profitable so far as long as the stock is in a Sector and Industry that is in an uptrend.

    So here's what I want:
    A stock makes a 52 week low.
    Then it makes a higher high and a higher low on consecutive days for anywhere from three to seven days.

    Thank you.
  • A one year (52 weeks or 251 days) low is

    low = min(251,low)

    consecutive higher highs is

    Streak Up(x, high) - x is the number of consecutive highs you want

    consecutive lower lows is

    Streak Up(x, low)

    You need to add a modifier to the first condition (low = min(251,low) to specify how many days ago the low occurred - e.g.

    and [4 days ago low = 4 days ago min(251,low)]

    Then you need to specify how long the Streak Ups should be - it needs to be one less than the number for the x days ago low.

    Note that it doesn't make sense to specify a scan to find one-year lows say, four days ago, then look for a seven day Streak Up - 7 days haven't gone by yet.

    But you also don't want to specify that the low happened, say ten days ago with a 7 day Streak Up. If you want that, you specify an offset for the Streak Up (in this case, "and [3 days ago Streak Up(7,low)]". That just gets too complicated.

    You want the scan to pick up the hit on the last day of the streak - e.g. if the low was 4 days ago, today should be day 3 of Streak Up(3.low). If the low was 8 days ago, the scan date should be day 7 of Streak Up(7,high).

    So, if you want to pick up lows with Streaks Up of different lengths, the low has to be in the past by one day more than the length of the streak - so if the you want a streak that is 5 days, you want to ask for the low to be 6 days ago.

    and [6 days ago low = 6 days ago min(251, low)]
    and [Streak Up(high) = 5]
    and [Streak Up(low) = 5]

    If you want the streak to be 3, the low has to be 4 days ago

    and [4 days ago low = 4 days ago min(251, low)]
    and [Streak Up(high) = 3]
    and [Streak Up(low) = 3]

    and if you run the scan today, today is day 3 of Streak Up(3, ...) and today is day 5 of Streak Up(5...).

    Hope that helps.
  • It doesn't work.

    [[type=stock]
    and [country is US]

    and [ [[2 days ago low = 2 days ago min(251, low)]
    and [Streak Up(high) = 1]
    and [Streak Up(low) = 1]]
    or]
    and [ [[3 days ago low = 3 days ago min(251, low)]
    and [Streak Up(high) = 2]
    and [Streak Up(low) = 2]]
    or]
    and [ [[4 days ago low = 4 days ago min(251, low)]
    and [Streak Up(high) = 3]
    and [Streak Up(low) = 3]]

    and [Low > 25.00]
    and [Volume > 500,000]]]
  • lmkwinlmkwin ✭✭
    edited November 9
    doesn't pass the Syntax check. You have an "or]" followed by an "and". Removing the Or or the And will be required.

    and [[[2 days ago low = 2 days ago min(251, low)]
    and [Streak Up(high) = 1]
    and [Streak Up(low) = 1]]

    and [[3 days ago low = 3 days ago min(251, low)]
    and [Streak Up(high) = 2]
    and [Streak Up(low) = 2]]

    and [[4 days ago low = 4 days ago min(251, low)]
    and [Streak Up(high) = 3]
    and [Streak Up(low) = 3]]

    and [Low > 25.00]
    and [Volume > 500,000]]

    passes Syntax check but returns no results, which is not surprising. Changing the 1st And in each set to an Or also produces 0 results.
  • markdmarkd mod
    edited November 9
    Doesn't work as in "doesn't run at all"? or "doesn't get expected results"?

    I found it gets zero results (in my version below) if you leave in low = 25 and volume > 500K. So I commented out those lines.

    Try that on your version first - see if it works. In the meantime, I edited your scan to take out some brackets and some "and"s that weren't necessary.

    However, looking at the results, you should also try adjusting the parameters so that you have the SAME number for "days ago" and Streak Up - e.g. 1 day ago and Streak Up(high) = 1.

    The one bar difference, e.g., 3 days ago and Streak Up(2, high) will get results, but it leaves one bar unaccounted for. Three days ago is actually the FOURTH bar back, whereas Streak 2 only looks back two bars (today and yesterday). That means bar 3 looking back can be anything, and you may not want that.

    So, try this as is and save the results to a list. Then adjust the numbers so they have equal parameters for days ago and streak (e.g. 3 days ago and streak 3) and see which you like better:

    // begin scan

    // all stocks must have these characteristics - always on top
    [type=stock]
    and [country is US]
    //and [Low > 25.00]
    //and [Volume > 500,000]

    // stocks must have at least one of these sets of conditions
    and

    [ // days or - begin

    [ // 2 days ago begin

    [2 days ago low = 2 days ago min(251, low)]
    and [Streak Up(high) = 1]
    and [Streak Up(low) = 1]

    ] // 2 days end

    or


    [ // 3 days ago begin

    [3 days ago low = 3 days ago min(251, low)]
    and [Streak Up(high) = 2]
    and [Streak Up(low) = 2]

    ] // 3 days end

    or

    [ // 4 days ago begin
    [4 days ago low = 4 days ago min(251, low)]
    and [Streak Up(high) = 3]
    and [Streak Up(low) = 3]

    ] // 4 days end

    ] // end days or

    // end scan

    TIP: when writing an "or" statement, give each "or" bracket [ ] a separate line, and LABEL it - // or begin, //or end, or maybe "// or open" with "// or close" . It seems like more work and it looks funny and it takes up a lot space, but it reduces confusion and that saves A LOT of time. It's also a good idea to do the same thing for grouping brackets, like" [ // 2 days go begin " in this example. Pros always document what they are doing. You should, too.
  • Why are penny and low priced stocks turning up in the scan when this is being used?

    //and [Low > 25.00]
    //and [Volume > 500,000]
  • What does this mean??

    min(251, low)]

    The low in the last 251 days?
  • I got the this working.
    //and [Low > 25.00]
    //and [Volume > 500,000]

    I made a mistake using a 251 days. I got this SHORT strategy confused with another LONG strategy I use that uses a 52 week low.

    The strategy you are currently helping me with now is a SHORT strategy and uses a two month low, So I changed the 251 days to 60 days.

    Happy to say the scan works great. I ran it for Friday and I got eight stocks that have over 500,000 volume.

    I really appreciate your help. I am happy to say that I now have all the scans I need.

    The two strategies you helped me with are not mine. They were created by Dave Landry. Dave currently does videos for StockCharts.com.

    Would you like the two Landry scans you helped me with and the directions on how to trade them?

    I have traded the first Landry LONG strategy (Explosion Gap Pivot) you helped me with and it has been profitable. The secret is to only trade the stocks that belong to a Industry and Sector that are also trending higher.

    I have not traded the SHORT strategy (Stock Pullback Short) you just helped me with yet.

    Let me know.

    Thanks again for your help.

    Barry
  • Hi Barry, thanks for the offer. I've developed a pretty full set of set-ups, so I'm not in the market for now. There is only so much time. Nevertheless, feel free to post a working scan here if you would like to share.

    P.S. 60 days is 12 weeks or about 3 months (5 trading days in a week x 12 = 60). Obviously, that doesn't matter if it's working for you.
  • People share their good ideas on this board frequently. @markd shares his knowledge very generously.
  • Where would be the best place to post the scan and the strategy for it?
Sign In or Register to comment.