Screening for Gaps


Trying to create a script which removes or identifies stocks which have gapped up or down more than 15% in the last 90 days. PS this is a screen to avoid volatile stocks which can also crash supported by Andreas Clenow's work.

So far the closest I have gotten is using Clark's volatilty script: highesthigh(cv(), BARS=90) < 5 (but this misses the mark)



Hi Mandeep,

To define a gap down try something like this to calculate the % difference from the previous bar’s low and the current bar’s high:

(LOW()[1] - HIGH())/LOW()[1]

so for a 15% gap the complete formula would be

(LOW()[1] - HIGH())/LOW()[1] > 0.15

For a gap up:


thanks Darren - would it be correct to use:

timesincesignal((LOW()[1] - HIGH())/LOW()[1] > 0.15) < 90

To add the time component of having this gap anytime within the last 90 days

Correct. Remember to use the formula in a Show Bar tool to verify that it is doing what you expect it to be doing.

In this example your formula is true when the gap occurred within the last 90 bars (trading days), and turns false on the 90th bar:


To scan for daily Gap Ups use the following:

OPEN() > HIGH()[1] and LOW()>HIGH()[1]

Gap Downs:

OPEN() < LOW()[1] and HIGH()<LOW()[1]

Open the scan results as a watchlist and add columns, then every time the workbook is opened the watchlist will update.