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.
Skrypt chroniony
Ten skrypt został opublikowany jako zamknięty kod źródłowy. Można z tego korzystać swobodnie i bez żadnych ograniczeń — więcej informacji znajduje się tutaj.
Wyłączenie odpowiedzialności
Informacje i publikacje nie stanowią i nie powinny być traktowane jako porady finansowe, inwestycyjne, tradingowe ani jakiekolwiek inne rekomendacje dostarczane lub zatwierdzone przez TradingView. Więcej informacji znajduje się w Warunkach użytkowania.
Skrypt chroniony
Ten skrypt został opublikowany jako zamknięty kod źródłowy. Można z tego korzystać swobodnie i bez żadnych ograniczeń — więcej informacji znajduje się tutaj.
Wyłączenie odpowiedzialności
Informacje i publikacje nie stanowią i nie powinny być traktowane jako porady finansowe, inwestycyjne, tradingowe ani jakiekolwiek inne rekomendacje dostarczane lub zatwierdzone przez TradingView. Więcej informacji znajduje się w Warunkach użytkowania.