Yesterday's close within 2% of 52 week high, but no new 52 week high in the last 90 days

I am trying to write a scan that will return all stocks that are within 2% of their 52 week high, but which have not had a new 52 week high in the last 90 days.

It is probably simple, but I a stuck.

I have:

[ [type = stock] and [country = US] ] and
[
[high > 1 day ago max(253,high) * .98] and // Price is greater than 98 of the 52 week high
[high < 1 day ago max(253,high)] and // but is less that the 52 week high
[1 day ago max(90,high) < 1 day ago max(253, high)] // and the hasn't made a new high in 90 days.
]

I am getting stocks that are making daily new highs.

Comments

  • Try line 2: [ high>(1 day ago max(253,high) *.98)]

  • markd
    markd mod
    edited February 2017
    This doesn't produce any charts with a new 253 high (that I could find):

    and [max(90,high) < max(253, high)] // hasn't made a high above today's max 253 high for 90 days

    and [high > max(253,high) * .98] // but today's high is within 2 % of today's max 253 high

    If you don't want today's high to be a new high, you can include today in the max( ). That way, the first statement should guarantee that you don't get a new 253 high.

  • My apologies for the delayed response. Busy busy. Thanks Markd! This works perfectly.