// Input: Time confirmation in seconds confirmTime = input(5, title="Seconds to Confirm")
// Track the candle open and its color consistency var float openPrice = na var bool isConfirmed = false var bool isBullish = false var int startTime = na
if bar_index != bar_index[1] // New candle openPrice := open isConfirmed := false startTime := timenow
if not isConfirmed and (timenow - startTime) >= confirmTime * 1000 if close > openPrice and high == close // Green candle stays green isBullish := true strategy.entry("Buy", strategy.long) isConfirmed := true else if close < openPrice and low == close // Red candle stays red isBullish := false strategy.entry("Sell", strategy.short) isConfirmed := true