PROTECTED SOURCE SCRIPT
OTP - 1HR ZONES v3

OTP - 1HR ZONES v3
My understanding of the changes you want (without breaking what’s already working)
You’re saying the current “BASE” logic is correctly finding your winning-trade zones, so we must not change the core displacement definition (body vs avg * multiplier + prior candle wick-to-wick). The tweaks you want are:
Stop the “candle after” problem
When a displacement candle prints, the zone must be drawn on the PRIOR candle (the origin candle), not shifted onto the next candle/bar.
Practically: the box needs to be anchored to the prior 1H candle’s time window, not the current bar_index.
Reduce “too many zones” without changing the core detection
You want fewer boxes, but without tightening the displacement logic (since it’s already catching winners).
Best non-disruptive filter: only create zones once per 1H candle close (prevents duplicates/spam on 5m/15m charts), and optionally filter by a session window (like your trading hours).
Make it work cleanly on 5m/15m
Right now on lower timeframes it can “spam” because the HTF values repeat on each LTF candle.
Fix: only fire on the moment the 1H candle closes, and draw the zone using bar_time of the prior 1H candle, so it’s always placed correctly.
That’s what the script below does.
READ BELOW:
What you should set first (so you don’t disrupt winners)
Leave displacementMult = 1.5 and Avg Body Length = 20 as-is.
Turn Filter zones by session? ON only if you want to cut noise fast.
If your true window is 9–11am, set Session to 0900-1100.
If it’s 6–10, leave 0600-1000.
My understanding of the changes you want (without breaking what’s already working)
You’re saying the current “BASE” logic is correctly finding your winning-trade zones, so we must not change the core displacement definition (body vs avg * multiplier + prior candle wick-to-wick). The tweaks you want are:
Stop the “candle after” problem
When a displacement candle prints, the zone must be drawn on the PRIOR candle (the origin candle), not shifted onto the next candle/bar.
Practically: the box needs to be anchored to the prior 1H candle’s time window, not the current bar_index.
Reduce “too many zones” without changing the core detection
You want fewer boxes, but without tightening the displacement logic (since it’s already catching winners).
Best non-disruptive filter: only create zones once per 1H candle close (prevents duplicates/spam on 5m/15m charts), and optionally filter by a session window (like your trading hours).
Make it work cleanly on 5m/15m
Right now on lower timeframes it can “spam” because the HTF values repeat on each LTF candle.
Fix: only fire on the moment the 1H candle closes, and draw the zone using bar_time of the prior 1H candle, so it’s always placed correctly.
That’s what the script below does.
READ BELOW:
What you should set first (so you don’t disrupt winners)
Leave displacementMult = 1.5 and Avg Body Length = 20 as-is.
Turn Filter zones by session? ON only if you want to cut noise fast.
If your true window is 9–11am, set Session to 0900-1100.
If it’s 6–10, leave 0600-1000.
สคริปต์ที่ได้รับการป้องกัน
สคริปต์นี้ถูกเผยแพร่เป็นแบบ closed-source อย่างไรก็ตาม คุณสามารถใช้ได้อย่างอิสระและไม่มีข้อจำกัดใดๆ – เรียนรู้เพิ่มเติมได้ที่นี่
คำจำกัดสิทธิ์ความรับผิดชอบ
ข้อมูลและบทความไม่ได้มีวัตถุประสงค์เพื่อก่อให้เกิดกิจกรรมทางการเงิน, การลงทุน, การซื้อขาย, ข้อเสนอแนะ หรือคำแนะนำประเภทอื่น ๆ ที่ให้หรือรับรองโดย TradingView อ่านเพิ่มเติมใน ข้อกำหนดการใช้งาน
สคริปต์ที่ได้รับการป้องกัน
สคริปต์นี้ถูกเผยแพร่เป็นแบบ closed-source อย่างไรก็ตาม คุณสามารถใช้ได้อย่างอิสระและไม่มีข้อจำกัดใดๆ – เรียนรู้เพิ่มเติมได้ที่นี่
คำจำกัดสิทธิ์ความรับผิดชอบ
ข้อมูลและบทความไม่ได้มีวัตถุประสงค์เพื่อก่อให้เกิดกิจกรรมทางการเงิน, การลงทุน, การซื้อขาย, ข้อเสนอแนะ หรือคำแนะนำประเภทอื่น ๆ ที่ให้หรือรับรองโดย TradingView อ่านเพิ่มเติมใน ข้อกำหนดการใช้งาน