OPEN-SOURCE SCRIPT
9th and 5th Candle Pattern - High/Low Break Logic

I implemented a Pine-Script (TradingView, v5) indicator that looks at a 9-candle window and marks the two patterns you described, with a clear, tweakable interpretation so it’s useful immediately on your chart.
My interpretation (keeps things deterministic & chart-friendly):
We treat the current bar as the 9th candle and look back 8 bars (so the 5th candle is close[4] / open[4]).
Pattern A (5th green):
If candle #5 is bullish (close[4] > open[4]) AND none of the next 4 candles (6,7,8,9 → offsets [3,2,1,0]) have a low below candle #5 low (i.e. that low was not broken), AND the 6th candle (offset 3) made a higher high than candle #5, then the script places a label/arrow on the 6th candle saying a bullish continuation / "up possible" signal.
Pattern B (5th red):
If candle #5 is bearish (close[4] < open[4]) AND within the next 4 candles the high moved above candle #5 high (i.e. price attempted to reverse), then the script places a label/arrow on the 9th (current) candle indicating a possible high / reversal by the 9th.
You can tweak the number of look-ahead candles or the strictness easily in the code comments.
My interpretation (keeps things deterministic & chart-friendly):
We treat the current bar as the 9th candle and look back 8 bars (so the 5th candle is close[4] / open[4]).
Pattern A (5th green):
If candle #5 is bullish (close[4] > open[4]) AND none of the next 4 candles (6,7,8,9 → offsets [3,2,1,0]) have a low below candle #5 low (i.e. that low was not broken), AND the 6th candle (offset 3) made a higher high than candle #5, then the script places a label/arrow on the 6th candle saying a bullish continuation / "up possible" signal.
Pattern B (5th red):
If candle #5 is bearish (close[4] < open[4]) AND within the next 4 candles the high moved above candle #5 high (i.e. price attempted to reverse), then the script places a label/arrow on the 9th (current) candle indicating a possible high / reversal by the 9th.
You can tweak the number of look-ahead candles or the strictness easily in the code comments.
Script open-source
In pieno spirito TradingView, il creatore di questo script lo ha reso open-source, in modo che i trader possano esaminarlo e verificarne la funzionalità. Complimenti all'autore! Sebbene sia possibile utilizzarlo gratuitamente, ricorda che la ripubblicazione del codice è soggetta al nostro Regolamento.
Declinazione di responsabilità
Le informazioni ed i contenuti pubblicati non costituiscono in alcun modo una sollecitazione ad investire o ad operare nei mercati finanziari. Non sono inoltre fornite o supportate da TradingView. Maggiori dettagli nelle Condizioni d'uso.
Script open-source
In pieno spirito TradingView, il creatore di questo script lo ha reso open-source, in modo che i trader possano esaminarlo e verificarne la funzionalità. Complimenti all'autore! Sebbene sia possibile utilizzarlo gratuitamente, ricorda che la ripubblicazione del codice è soggetta al nostro Regolamento.
Declinazione di responsabilità
Le informazioni ed i contenuti pubblicati non costituiscono in alcun modo una sollecitazione ad investire o ad operare nei mercati finanziari. Non sono inoltre fornite o supportate da TradingView. Maggiori dettagli nelle Condizioni d'uso.