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.
Skrip open-source
Dengan semangat TradingView yang sesungguhnya, penulis skrip ini telah menjadikannya sumber terbuka, sehingga para trader dapat meninjau dan memverifikasi fungsinya. Hormat untuk penulisnya! Meskipun anda dapat menggunakannya secara gratis, ingatlah bahwa penerbitan ulang kode tersebut tunduk pada Tata Tertib kami.
Pernyataan Penyangkalan
Informasi dan publikasi tidak dimaksudkan untuk menjadi, dan bukan merupakan saran keuangan, investasi, perdagangan, atau rekomendasi lainnya yang diberikan atau didukung oleh TradingView. Baca selengkapnya di Persyaratan Penggunaan.
Skrip open-source
Dengan semangat TradingView yang sesungguhnya, penulis skrip ini telah menjadikannya sumber terbuka, sehingga para trader dapat meninjau dan memverifikasi fungsinya. Hormat untuk penulisnya! Meskipun anda dapat menggunakannya secara gratis, ingatlah bahwa penerbitan ulang kode tersebut tunduk pada Tata Tertib kami.
Pernyataan Penyangkalan
Informasi dan publikasi tidak dimaksudkan untuk menjadi, dan bukan merupakan saran keuangan, investasi, perdagangan, atau rekomendasi lainnya yang diberikan atau didukung oleh TradingView. Baca selengkapnya di Persyaratan Penggunaan.