Hello!
I made a simple screener showing me stocks which broke yesterday’s high. Let’s say I use this screener at 18:00 and I see some stocks. Some of them already broke yesterday’s high minutes or hours before. But I only want to see stocks which broke yesterday’s high the first time today. Is it possible to check if all previous candles today were below yesterday’s high?
I thought about doing a loop and check if all highs were below yesterday’s high but maybe there is a more efficient way to do?
This is my simple code so far:
timeframe(15 minutes)
highbreak=high[1]>dhigh(1)
SCREENER [highbreak]
Any help is appreciated!
Just read something.. would this be correct? I can’t test it right now. Therefore I ask.
timeframe(15 minutes)
highbreak=high[1]>dhigh(1) and highest[intradaybarindex-2](high)<dhigh(1)
SCREENER [highbreak]
Seems ok to me. But you should add a test to verify the highest period is superior to 0, otherwise the screener will be stuck:
timeframe(15 minutes)
highbreak=high[1]>dhigh(1) and highest[max(1,intradaybarindex-2)](high)<dhigh(1)
SCREENER [highbreak]