Referencing a range of candles



New member
Hi All,

I'm trying perfect a breakout indicator/scanner based off the the Opening Range Breakout indicator. I want it to return true if (at least) one candle in the past 10 candles have touched a certain level (in this case the high of the opening range), and then the price dipped for a few candles, and then a candle closed over the ORH (opening range high).

I'm having a hard time writing the code without being too specific in the candles I'm referencing. Is there a way to reference 'at least one in the last 10 candles' rather than saying close[10] < ORH*.995 and low[5] < low[10] and low[1] > ORH etc....


Well-known member
@Variety_Jones Something like the following should work.

def ORH = <some value previously defined>

Now to reference at least one candle in the last 10 that have closed above it, then the condition you need is

sum(close > ORH, 10) >= 1

Similar threads