Hi . Anyone can help with coding a gap screener to find any stock that opens 2% lower than the lowest of last 10 days or 2% higher than the highest of the last 10 days and the open volume (Volume at the first minute bar) is above average of the past 10 days open volumes.
There you go:
N = 10
LL = lowest[N](low)
HH = highest[N](high)
c1 = open >= (HH[1] * 1.02)
c2 = open <= (LL[1] * 0.98)
c3 = volume > average[N](volume)
SCREENER[(c1 OR c2) AND c3](volume as "Volume")
The average volume is calculated on the whole bar itself, not just the first minute, as it’s not possible because there are only 254 bars available to scan backwards which is about 4 hours only!
The 254-bar limit scarcely allows to scan the first HOUR.
This is with the first hour (you need to set the opening time of the FIRST hourly candle):
Timeframe(Daily)
LL = lowest[N](low)
HH = highest[N](high)
//
Timeframe(1 hour)
CheckTime = 000000 //time of the opening of the first hourly candle
N = 10
t = 0
VL = 0
FOR i = 0 TO 254
IF OpenTime[i] = CheckTime THEN
t = t + 1
VL = VL + volume[i]
IF t = N THEN
Break
ENDIF
ENDIF
NEXT
FirstHOUR = VL / t
c1 = open >= (HH[1] * 1.02)
c2 = open <= (LL[1] * 0.98)
c3 = volume > FirstHOUR
SCREENER[(c1 OR c2) AND c3](volume as "Volume")
As to the strategy I will be able to check the very first minute, as it allows to scan 200K bars!