Greetings!
Im using this gap screener to get access the daily gap ups/downs, and trade them 30 minutes after the market opens. Therefore I need the list of stocks sorted between 0-100 %, in that way where 0 is the most prioritized. “Priority”in the code below gives how many % the close is from either the low or high (whichever of the two has the shortest distance) of the 09:00 – 09:30 candlestick.
It doesnt work as intended, some stocks sometimes show priority=0 when the high != close for example. Can you see my mistake?
Thank you
Timeframe(daily)
Filter = (open>high[1]) or (open<low[1])
timeframe(30 minutes)
if time => 090000 and time < 093000 then
priority = 100 * min((ABS(high-close)/close),(ABS(close-low)/close))
endif
SCREENER[ filter ](priority as "priority")
Because between 9 and 9:30 you only select priority, not the filter which is on a daily TF.
Try this one:
Timeframe(daily)
Filter = (open>high[1]) or (open<low[1])
timeframe(30 minutes)
TimeOK = 0
if time => 090000 and time < 093000 then
TimeOK = 1
priority = 100 * min((ABS(high-close)/close),(ABS(close-low)/close))
endif
SCREENER[ Filter AND TimeOK ](priority as "priority")