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.
สคริปต์โอเพนซอร์ซ
ด้วยเจตนารมณ์หลักของ TradingView ผู้สร้างสคริปต์นี้ได้ทำให้มันเป็นโอเพ่นซอร์ส เพื่อให้เทรดเดอร์สามารถตรวจสอบและยืนยันการทำงานของสคริปต์ได้ ขอแสดงความชื่นชมผู้เขียน! แม้ว่าคุณจะสามารถใช้งานได้ฟรี แต่อย่าลืมว่าการเผยแพร่โค้ดซ้ำนั้นจะต้องเป็นไปตามกฎระเบียบการใช้งานของเรา
คำจำกัดสิทธิ์ความรับผิดชอบ
ข้อมูลและบทความไม่ได้มีวัตถุประสงค์เพื่อก่อให้เกิดกิจกรรมทางการเงิน, การลงทุน, การซื้อขาย, ข้อเสนอแนะ หรือคำแนะนำประเภทอื่น ๆ ที่ให้หรือรับรองโดย TradingView อ่านเพิ่มเติมที่ ข้อกำหนดการใช้งาน
สคริปต์โอเพนซอร์ซ
ด้วยเจตนารมณ์หลักของ TradingView ผู้สร้างสคริปต์นี้ได้ทำให้มันเป็นโอเพ่นซอร์ส เพื่อให้เทรดเดอร์สามารถตรวจสอบและยืนยันการทำงานของสคริปต์ได้ ขอแสดงความชื่นชมผู้เขียน! แม้ว่าคุณจะสามารถใช้งานได้ฟรี แต่อย่าลืมว่าการเผยแพร่โค้ดซ้ำนั้นจะต้องเป็นไปตามกฎระเบียบการใช้งานของเรา
คำจำกัดสิทธิ์ความรับผิดชอบ
ข้อมูลและบทความไม่ได้มีวัตถุประสงค์เพื่อก่อให้เกิดกิจกรรมทางการเงิน, การลงทุน, การซื้อขาย, ข้อเสนอแนะ หรือคำแนะนำประเภทอื่น ๆ ที่ให้หรือรับรองโดย TradingView อ่านเพิ่มเติมที่ ข้อกำหนดการใช้งาน