OPEN-SOURCE SCRIPT
Premium Discount Equilibrium [forexobroker]

Premium Discount Equilibrium [forexobroker] builds a dealing range from the rolling N-bar high and low and marks its 50% midpoint as equilibrium: above it is premium (expensive, favor shorts), below it is discount (cheap, favor longs). The unique angle is executing the ICT premium/discount model on an EMA reclaim so entries are timed rather than merely biased, with an optional Optimal Trade Entry (OTE) band gate for deeper-discount / higher-premium precision.
🔶 ALGORITHM
1. Build the dealing range from the highest high and lowest low over Dealing Range Length bars.
2. Compute equilibrium as the range midpoint (rngHi + rngLo) / 2, with an EQ Buffer expressed as a fraction of range defining a neutral band where no bias applies.
3. Classify price: in premium when close is above EQ + buffer, in discount when below EQ - buffer.
4. Derive the OTE bands: discount OTE = 21% to 38% off the low, premium OTE = 21% to 38% off the high (the classic 62-79% retrace zone), used for an optional confirmation gate.
5. Entry timing: an EMA reclaim (ta.crossover / ta.crossunder of close vs the Reclaim EMA) inside the correct zone times the trade; long entries require discount, short entries require premium.
6. Optional Require OTE Zone filter restricts signals to bars inside the matching OTE band.
🔶 SIGNAL LOGIC
- Buy: price in discount (close below EQ - buffer) and close crosses over the Reclaim EMA, in session, OTE gate satisfied if enabled, position not already long, after the cooldown window, only on barstate.isconfirmed; position-lock flips to LONG.
- Sell: price in premium (close above EQ + buffer) and close crosses under the Reclaim EMA, in session, OTE gate satisfied if enabled, position not already short, cooldown elapsed, on barstate.isconfirmed; position-lock flips to SHORT.
Only fires when price is on the correct side of equilibrium (discount for longs, premium for shorts).
🔶 INPUTS
- Range: dealing range length for the high/low window (default 60) and ATR length.
- Equilibrium band: EQ buffer as a fraction of range defining the neutral no-bias zone (default 0.05).
- Signal Logic: Reclaim EMA length (default 9).
- OTE: show OTE 62-79 band toggle (default on).
- Cooldown: minimum bars between signals (default 5).
- Filters: optional session restriction and a Require OTE Zone gate (default off).
- Visual: zone plots (EQ, range high/low, OTE fills), dashboard, 3-layer glow, buy/sell colors, dashboard background.
🔶 ALERTS
PDE Buy, PDE Sell, PDE Any Signal, PDE Enter Premium, PDE Enter Discount, PDE Discount OTE, PDE Premium OTE, PDE EQ Cross, PDE EMA Up, PDE EMA Down, PDE Range High, PDE Range Low, PDE Webhook JSON.
🔶 LIMITATIONS
- Requires warm-up: the dealing range needs Dealing Range Length bars before it stabilizes.
- The range high/low recompute every bar, so equilibrium and zones shift as the rolling window moves; signals themselves confirm on bar close and do not repaint.
- Defaults are tuned for liquid instruments; range length and EQ buffer may need adjustment per market.
- Require OTE Zone mode is stricter and produces noticeably fewer signals.
- Premium/discount is a contextual bias, not a guaranteed reversal; ranging-to-trending transitions can keep price extended in one zone.
🔶 ALGORITHM
1. Build the dealing range from the highest high and lowest low over Dealing Range Length bars.
2. Compute equilibrium as the range midpoint (rngHi + rngLo) / 2, with an EQ Buffer expressed as a fraction of range defining a neutral band where no bias applies.
3. Classify price: in premium when close is above EQ + buffer, in discount when below EQ - buffer.
4. Derive the OTE bands: discount OTE = 21% to 38% off the low, premium OTE = 21% to 38% off the high (the classic 62-79% retrace zone), used for an optional confirmation gate.
5. Entry timing: an EMA reclaim (ta.crossover / ta.crossunder of close vs the Reclaim EMA) inside the correct zone times the trade; long entries require discount, short entries require premium.
6. Optional Require OTE Zone filter restricts signals to bars inside the matching OTE band.
🔶 SIGNAL LOGIC
- Buy: price in discount (close below EQ - buffer) and close crosses over the Reclaim EMA, in session, OTE gate satisfied if enabled, position not already long, after the cooldown window, only on barstate.isconfirmed; position-lock flips to LONG.
- Sell: price in premium (close above EQ + buffer) and close crosses under the Reclaim EMA, in session, OTE gate satisfied if enabled, position not already short, cooldown elapsed, on barstate.isconfirmed; position-lock flips to SHORT.
Only fires when price is on the correct side of equilibrium (discount for longs, premium for shorts).
🔶 INPUTS
- Range: dealing range length for the high/low window (default 60) and ATR length.
- Equilibrium band: EQ buffer as a fraction of range defining the neutral no-bias zone (default 0.05).
- Signal Logic: Reclaim EMA length (default 9).
- OTE: show OTE 62-79 band toggle (default on).
- Cooldown: minimum bars between signals (default 5).
- Filters: optional session restriction and a Require OTE Zone gate (default off).
- Visual: zone plots (EQ, range high/low, OTE fills), dashboard, 3-layer glow, buy/sell colors, dashboard background.
🔶 ALERTS
PDE Buy, PDE Sell, PDE Any Signal, PDE Enter Premium, PDE Enter Discount, PDE Discount OTE, PDE Premium OTE, PDE EQ Cross, PDE EMA Up, PDE EMA Down, PDE Range High, PDE Range Low, PDE Webhook JSON.
🔶 LIMITATIONS
- Requires warm-up: the dealing range needs Dealing Range Length bars before it stabilizes.
- The range high/low recompute every bar, so equilibrium and zones shift as the rolling window moves; signals themselves confirm on bar close and do not repaint.
- Defaults are tuned for liquid instruments; range length and EQ buffer may need adjustment per market.
- Require OTE Zone mode is stricter and produces noticeably fewer signals.
- Premium/discount is a contextual bias, not a guaranteed reversal; ranging-to-trending transitions can keep price extended in one zone.
Script open-source
Dans l'esprit TradingView, le créateur de ce script l'a rendu open source afin que les traders puissent examiner et vérifier ses fonctionnalités. Bravo à l'auteur! Bien que vous puissiez l'utiliser gratuitement, n'oubliez pas que la republication du code est soumise à nos Règles.
🔵Gain access to our powerful tools : forexobroker.com/tv
🔵Join our free telegram for updates : t.me/dominicwalsfxhtrader
All scripts & content provided by Forexobroker are for informational & educational purposes only.
🔵Join our free telegram for updates : t.me/dominicwalsfxhtrader
All scripts & content provided by Forexobroker are for informational & educational purposes only.
Clause de non-responsabilité
Les informations et publications ne sont pas destinées à être, et ne constituent pas, des conseils ou recommandations financiers, d'investissement, de trading ou autres fournis ou approuvés par TradingView. Pour en savoir plus, consultez les Conditions d'utilisation.
Script open-source
Dans l'esprit TradingView, le créateur de ce script l'a rendu open source afin que les traders puissent examiner et vérifier ses fonctionnalités. Bravo à l'auteur! Bien que vous puissiez l'utiliser gratuitement, n'oubliez pas que la republication du code est soumise à nos Règles.
🔵Gain access to our powerful tools : forexobroker.com/tv
🔵Join our free telegram for updates : t.me/dominicwalsfxhtrader
All scripts & content provided by Forexobroker are for informational & educational purposes only.
🔵Join our free telegram for updates : t.me/dominicwalsfxhtrader
All scripts & content provided by Forexobroker are for informational & educational purposes only.
Clause de non-responsabilité
Les informations et publications ne sont pas destinées à être, et ne constituent pas, des conseils ou recommandations financiers, d'investissement, de trading ou autres fournis ou approuvés par TradingView. Pour en savoir plus, consultez les Conditions d'utilisation.