OPEN-SOURCE SCRIPT
Zaktualizowano Premium/Discount Retracement Indicator

The indicator works in four layers.
**The major swing** — it scans the chart for a significant impulse move using a pivot-based lookback. Once it finds a clear swing low and swing high (or high then low), it locks that range in and draws a horizontal 50% line across the middle. Everything above that line is premium, everything below is discount.
**The retracement zone** — after the major move, it watches for a smaller pullback forming within the range. When that pullback produces its own local high and local low, those two levels become the zone boundaries. The zone is drawn as a two-colour box: teal on top, red on the bottom, split at the midpoint. Only zones sitting in the discount area qualify for buys, and only zones in the premium area qualify for sells, so it automatically filters out setups that go against the structure.
**The entry** — a limit order line sits at the exact midpoint of the zone. Nothing happens until price returns to that level. If price dips into the zone but reverses before touching the midpoint and then closes back above the zone boundary, the zone is marked as rejected and the limit is cancelled automatically. This handles the scenario where price taps the upper portion of the zone but doesn't commit.
**Trade levels** — once the limit is hit, three levels are displayed. The stop loss is placed just beyond the outer zone boundary with a small buffer. The take profit is calculated at 1:2 risk-to-reward from the entry. A break-even line sits at the 1:1 level, and an alert fires when price reaches it so you know when to move your stop to entry.
There are also four alerts: zone created, order filled, zone cancelled, and move to break even.
**The major swing** — it scans the chart for a significant impulse move using a pivot-based lookback. Once it finds a clear swing low and swing high (or high then low), it locks that range in and draws a horizontal 50% line across the middle. Everything above that line is premium, everything below is discount.
**The retracement zone** — after the major move, it watches for a smaller pullback forming within the range. When that pullback produces its own local high and local low, those two levels become the zone boundaries. The zone is drawn as a two-colour box: teal on top, red on the bottom, split at the midpoint. Only zones sitting in the discount area qualify for buys, and only zones in the premium area qualify for sells, so it automatically filters out setups that go against the structure.
**The entry** — a limit order line sits at the exact midpoint of the zone. Nothing happens until price returns to that level. If price dips into the zone but reverses before touching the midpoint and then closes back above the zone boundary, the zone is marked as rejected and the limit is cancelled automatically. This handles the scenario where price taps the upper portion of the zone but doesn't commit.
**Trade levels** — once the limit is hit, three levels are displayed. The stop loss is placed just beyond the outer zone boundary with a small buffer. The take profit is calculated at 1:2 risk-to-reward from the entry. A break-even line sits at the 1:1 level, and an alert fires when price reaches it so you know when to move your stop to entry.
There are also four alerts: zone created, order filled, zone cancelled, and move to break even.
Informacje o Wersji
updated bugsInformacje o Wersji
fixedInformacje o Wersji
updateInformacje o Wersji
updatedSkrypt open-source
W zgodzie z duchem TradingView twórca tego skryptu udostępnił go jako open-source, aby użytkownicy mogli przejrzeć i zweryfikować jego działanie. Ukłony dla autora. Korzystanie jest bezpłatne, jednak ponowna publikacja kodu podlega naszym Zasadom serwisu.
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 open-source
W zgodzie z duchem TradingView twórca tego skryptu udostępnił go jako open-source, aby użytkownicy mogli przejrzeć i zweryfikować jego działanie. Ukłony dla autora. Korzystanie jest bezpłatne, jednak ponowna publikacja kodu podlega naszym Zasadom serwisu.
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.