0
votes

I'm trying to isolate a simple pattern for each trading day, just the first set of consecutive red candles.

strategy("fourRed", overlay=true)

var fourRedOccur = false

fourRedCandles = not fourRedOccur and (close[3] < open[3]) and (close[2] < open[2]) and (close[1] < open[1]) and (close < open)

if (fourRedCandles)
    fourRedOccur := true

plotshape(series=fourRedCandles, style=shape.xcross, color=white, location=location.belowbar)

So far, I can't seem to:

1) Isolate only the first occurrence
2) Make it so this only shows up once per day (do I need to introduce time?)

1

1 Answers

0
votes

You can use this to define your base condition:

fourRedCandles = sum(close < open ? 1 : 0, 4) == 4