Objective:
Mark a bullish candle with a red arrow if a bearish sequence afterward eventually closes below both the bullish open and the last bearish close prior to the bullish candle.
Rules:
Detect bullish candle ( close > open ).
Look back up to 20 candles to find the most recent bearish candle before it → store its close.
Track up to 20 candles forward:
Check bearish candles ( close < open ).
Stop if a new bullish candle appears.
If a bearish candle closes below both:
Bullish candle open, and
Prior bearish close → plot red arrow on the bullish candle.
Reset tracking after the next bullish candle or 20 forward candles.
Objective:
Mark a bearish candle with a green arrow if a bullish sequence afterward eventually closes above both the bearish open and the last bullish close prior to the bearish candle.
Rules:
Detect bearish candle ( close < open ).
Look back up to 20 candles to find the most recent bullish candle before it → store its close.
Track up to 20 candles forward:
Check bullish candles ( close > open ).
Stop if a new bearish candle appears.
If a bullish candle closes above both:
Bearish candle open, and
Prior bullish close → plot green arrow on the bearish candle.
Reset tracking after the next bearish candle or 20 forward candles.
✅ Key Points (Both Patterns):
Uses lookback of 20 candles to find prior opposite candle.
Uses lookforward of 20 candles to track confirming sequence.
Arrow is always plotted on the original candle (bullish for red, bearish for green).
Triggered only when the sequence eventually confirms against the original candle’s open and prior opposite candle close.