OPEN-SOURCE SCRIPT
Dealing Range Equilibrium & Premium/Discount Zones (SMC)

This indicator is a streamlined visualization tool designed specifically for traders utilizing Smart Money Concepts (SMC) and ICT methodologies. It automatically detects the current structural Dealing Range and divides it into logical quadrants: Premium, Discount, and Equilibrium.
Rather than manually drawing Fibonacci grids on every new structural swing, this script dynamically anchors to the most recent validated pivot points, keeping your charts clean and your focus on price action.
Underlying Logic & Calculations
The script relies on a standard pivot-detection algorithm to establish the boundaries of the dealing range:
Swing Detection: It uses standard ta.pivothigh and ta.pivotlow functions to scan for structural highs and lows based on a user-defined "Swing Lookback Period" (default is 20 bars). A pivot high is confirmed when the central candle is higher than the n candles to its left and right.
Range Anchoring: Once a new swing high or low is validated, the top or bottom variables update respectively. These horizontal levels persist forward in time until a new structural pivot breaks them.
Equilibrium Calculation: The script calculates the mathematical median of the current range by adding the active Swing High and Swing Low, then dividing by two (top + bottom) / 2.
Visuals & Practical Usage
In SMC theory, markets move from consolidation to expansion, seeking liquidity. The dealing range helps traders contextualize where price is relative to recent structure:
Premium Zone (Red Fill): The upper 50% of the dealing range. In a bearish structural environment, traders look for price to retrace into the Premium zone to identify high-probability short setups or institutional distribution.
Discount Zone (Green Fill): The lower 50% of the dealing range. In a bullish environment, traders wait for price to retrace into the Discount zone to look for long setups or institutional accumulation.
Equilibrium (Midline): The exact 50% level (fair value). Price action around this line often acts as a transition point or near-term support/resistance.
Settings
Swing Lookback Period: Controls the sensitivity of the pivot detection. A lower number (e.g., 5 or 10) will capture micro-structure and minor pullbacks, ideal for scalping. A higher number (e.g., 20 or 50) will anchor only to major macro-swings.
Show Labels: Toggles the text labels on the current price axis to keep the chart clean if desired.
Rather than manually drawing Fibonacci grids on every new structural swing, this script dynamically anchors to the most recent validated pivot points, keeping your charts clean and your focus on price action.
Underlying Logic & Calculations
The script relies on a standard pivot-detection algorithm to establish the boundaries of the dealing range:
Swing Detection: It uses standard ta.pivothigh and ta.pivotlow functions to scan for structural highs and lows based on a user-defined "Swing Lookback Period" (default is 20 bars). A pivot high is confirmed when the central candle is higher than the n candles to its left and right.
Range Anchoring: Once a new swing high or low is validated, the top or bottom variables update respectively. These horizontal levels persist forward in time until a new structural pivot breaks them.
Equilibrium Calculation: The script calculates the mathematical median of the current range by adding the active Swing High and Swing Low, then dividing by two (top + bottom) / 2.
Visuals & Practical Usage
In SMC theory, markets move from consolidation to expansion, seeking liquidity. The dealing range helps traders contextualize where price is relative to recent structure:
Premium Zone (Red Fill): The upper 50% of the dealing range. In a bearish structural environment, traders look for price to retrace into the Premium zone to identify high-probability short setups or institutional distribution.
Discount Zone (Green Fill): The lower 50% of the dealing range. In a bullish environment, traders wait for price to retrace into the Discount zone to look for long setups or institutional accumulation.
Equilibrium (Midline): The exact 50% level (fair value). Price action around this line often acts as a transition point or near-term support/resistance.
Settings
Swing Lookback Period: Controls the sensitivity of the pivot detection. A lower number (e.g., 5 or 10) will capture micro-structure and minor pullbacks, ideal for scalping. A higher number (e.g., 20 or 50) will anchor only to major macro-swings.
Show Labels: Toggles the text labels on the current price axis to keep the chart clean if desired.
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.
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.