Scanning for price within 20% of 52 week high

Any suggestions on how to scan for stocks within 20% of 52 week highs?

Comments

  • and [close > max(251, high) * .8]

    close is today's close

    max(251, high) is the 52 week high, expressed as the maximum high in the last 251 trading days, which is about 1 year of trading days, accounting for 9 holidays.

    .8 is 80 per cent of the max high