I'd like to make a code that won't entering the position in a situation like in the picture.
greenCandle = barstate.isconfirmed and (close > open)
sixGreenCandles = greenCandle[6] and greenCandle[5] and greenCandle[4] and greenCandle[3] and greenCandle[2] and greenCandle[1]
I don't know the code to count the candle before entering the position
(Except for the candles at the signal)