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.

the scan syntax for find a stock with the condition ?

1. The Stock that break and close above the 40-week high
2. and the stock did not gap more than 5% over the last 60 days


  • The first part would be fairly easy. Test for the 40 week price channel to be flat for some number of days before today (the upper channel yesterday is equal to the upper channel some number of days or weeks ago; you would have to decide how long it has been since the stock last made a 40 week high - last week, two months ago, six months ago ), and today the close crosses above the upper price channel. So, something like 1 day ago upper channel(200) = 20 days ago upper channel(200) and close x upper price channel(200).

    I don't know of any indicator that tracks gaps. So, I think the second part would require comparing the low to the previous high every day for the past 60 days (low < 1 day ago high * 1.05, 1 day ago low < 2 days ago high *1.05, etc.).

    That's a lot of coding to cover 60 days. You might just want to refine what you want in the 40 week high crossing (first time in how long) and then just inspect the charts for the gaps, assuming you get just a reasonable number of results.
Sign In or Register to comment.