OPEN-SOURCE SCRIPT
Universal Market Ranges

█ OVERVIEW
Universal Market Ranges is a universal market indicator that, within a single tool, identifies trend direction and regime, shows price movement ranges relative to volatility, can be used as dynamic SL and TP levels, and offers optional signals generated separately for each zone.
The indicator is based on a smoothed moving average with an ATR-based significance filter and multi-level volatility bands, which organize the market into logical zones of increasing importance.
Instead of generating isolated signals, Universal Market Ranges provides full market context, allowing traders to make their own informed decisions.
█ CONCEPT
The core idea behind the indicator is full configurability, which allows it to be used for a wide range of trading purposes.
Depending on the settings and visibility of individual elements, Universal Market Ranges can function as:
- a complete trading system
- a clean trend indicator
- a single volatility channel
- a standalone filtered moving average
- a zone-based structure for position management (SL / TP)
By disabling selected bands, adjusting their multipliers, or modifying fill transparency, traders can tailor the indicator precisely to their trading style, market, and timeframe.
Moving Average Logic
The applied moving average is not classically weighted.
ATR acts here as a significance filter, determining whether a given price change is meaningful enough to affect the average.
When the price deviation from the MA exceeds a defined volatility threshold (ATR × multiplier), the moving average updates normally.
When price changes are too small and remain within market noise, the moving average remains unchanged.
As a result, the MA reacts only to significant price movements, ignoring minor fluctuations and consolidations.
█ ZONE STRUCTURE
- Trend Band (TB)
A channel used to define the trend regime.
- price breaking above the TB → trend shifts to bullish
- price breaking below the TB → trend shifts to bearish
The Trend Band can be visually disabled, while the trend logic continues to operate in the background.
- wider TB → less sensitive, fewer and later trend changes
- narrower TB → more sensitive, more frequent regime changes
- Inner Band (IB)
The primary zone of acceptable price deviation from the moving average.
- represents equilibrium and “comfortable” price movement
- Outer Band 1 (OB1)
A zone of clear market extension.
- first sign that price is moving away from equilibrium
- often used as a partial profit-taking level
- Outer Band 2 (OB2)
An extreme zone.
- very strong deviation from the moving average
- statistically rare price movements
- often marks the final phase of large impulses
█ FEATURES
Data Sources:
- Filtered moving average (SMA / EMA / RMA / WMA)
- ATR as the volatility measure for all zones
- Candle coloring based on the current trend regime
Signals (optional):
- Zone exit and return signals (IB / OB1 / OB2)
- Moving average cross in trend direction
- Trend regime change (TB breakout)
Visual Elements:
- Trend-based candle coloring
- Smooth fills between zones
- Labels with current price levels on the right side of the chart
Alerts:
- IB Breakout / Return
- OB1 & OB2 Exit / Return
- MA Cross in trend direction
- Trend Change (TB)
█ HOW TO USE
Adding the Indicator
Paste the code into the Pine Editor or search for
“Universal Market Ranges” on TradingView.
Key Settings:
- MA Length – moving average sensitivity
- ATR Length – band stability and width
- Minimum Deviation (ATR) – moving average update filter
→ lower values: MA updates more frequently but filters less noise
- Band Multipliers – define the significance of each zone
- MA Smoothing Type – determines the reaction character
█ USE CASES
Universal Market Ranges can be used for:
- trend trading – entries on trend regime changes
- defining dynamic SL and TP levels
- contrarian strategies – entries on price returns to zones
- analyzing price range and movement quality
Zone interpretation:
- price near the MA → market equilibrium
- price in OB1 → clear extension
- price in OB2 → extreme deviation from equilibrium
█ NOTES
- The indicator works on all instruments and timeframes
- Best results are achieved by adapting band multipliers to the market
- Can be combined with other technical analysis methods such as Fibonacci levels, FVG, and pivot levels
- This is not a signal-only system — it is a context-based analytical tool
Universal Market Ranges is a universal market indicator that, within a single tool, identifies trend direction and regime, shows price movement ranges relative to volatility, can be used as dynamic SL and TP levels, and offers optional signals generated separately for each zone.
The indicator is based on a smoothed moving average with an ATR-based significance filter and multi-level volatility bands, which organize the market into logical zones of increasing importance.
Instead of generating isolated signals, Universal Market Ranges provides full market context, allowing traders to make their own informed decisions.
█ CONCEPT
The core idea behind the indicator is full configurability, which allows it to be used for a wide range of trading purposes.
Depending on the settings and visibility of individual elements, Universal Market Ranges can function as:
- a complete trading system
- a clean trend indicator
- a single volatility channel
- a standalone filtered moving average
- a zone-based structure for position management (SL / TP)
By disabling selected bands, adjusting their multipliers, or modifying fill transparency, traders can tailor the indicator precisely to their trading style, market, and timeframe.
Moving Average Logic
The applied moving average is not classically weighted.
ATR acts here as a significance filter, determining whether a given price change is meaningful enough to affect the average.
When the price deviation from the MA exceeds a defined volatility threshold (ATR × multiplier), the moving average updates normally.
When price changes are too small and remain within market noise, the moving average remains unchanged.
As a result, the MA reacts only to significant price movements, ignoring minor fluctuations and consolidations.
█ ZONE STRUCTURE
- Trend Band (TB)
A channel used to define the trend regime.
- price breaking above the TB → trend shifts to bullish
- price breaking below the TB → trend shifts to bearish
The Trend Band can be visually disabled, while the trend logic continues to operate in the background.
- wider TB → less sensitive, fewer and later trend changes
- narrower TB → more sensitive, more frequent regime changes
- Inner Band (IB)
The primary zone of acceptable price deviation from the moving average.
- represents equilibrium and “comfortable” price movement
- Outer Band 1 (OB1)
A zone of clear market extension.
- first sign that price is moving away from equilibrium
- often used as a partial profit-taking level
- Outer Band 2 (OB2)
An extreme zone.
- very strong deviation from the moving average
- statistically rare price movements
- often marks the final phase of large impulses
█ FEATURES
Data Sources:
- Filtered moving average (SMA / EMA / RMA / WMA)
- ATR as the volatility measure for all zones
- Candle coloring based on the current trend regime
Signals (optional):
- Zone exit and return signals (IB / OB1 / OB2)
- Moving average cross in trend direction
- Trend regime change (TB breakout)
Visual Elements:
- Trend-based candle coloring
- Smooth fills between zones
- Labels with current price levels on the right side of the chart
Alerts:
- IB Breakout / Return
- OB1 & OB2 Exit / Return
- MA Cross in trend direction
- Trend Change (TB)
█ HOW TO USE
Adding the Indicator
Paste the code into the Pine Editor or search for
“Universal Market Ranges” on TradingView.
Key Settings:
- MA Length – moving average sensitivity
- ATR Length – band stability and width
- Minimum Deviation (ATR) – moving average update filter
→ lower values: MA updates more frequently but filters less noise
- Band Multipliers – define the significance of each zone
- MA Smoothing Type – determines the reaction character
█ USE CASES
Universal Market Ranges can be used for:
- trend trading – entries on trend regime changes
- defining dynamic SL and TP levels
- contrarian strategies – entries on price returns to zones
- analyzing price range and movement quality
Zone interpretation:
- price near the MA → market equilibrium
- price in OB1 → clear extension
- price in OB2 → extreme deviation from equilibrium
█ NOTES
- The indicator works on all instruments and timeframes
- Best results are achieved by adapting band multipliers to the market
- Can be combined with other technical analysis methods such as Fibonacci levels, FVG, and pivot levels
- This is not a signal-only system — it is a context-based analytical tool
Mã nguồn mở
Theo đúng tinh thần TradingView, tác giả của tập lệnh này đã công bố nó dưới dạng mã nguồn mở, để các nhà giao dịch có thể xem xét và xác minh chức năng. Chúc mừng tác giả! Mặc dù bạn có thể sử dụng miễn phí, hãy nhớ rằng việc công bố lại mã phải tuân theo Nội quy.
Thông báo miễn trừ trách nhiệm
Thông tin và các ấn phẩm này không nhằm mục đích, và không cấu thành, lời khuyên hoặc khuyến nghị về tài chính, đầu tư, giao dịch hay các loại khác do TradingView cung cấp hoặc xác nhận. Đọc thêm tại Điều khoản Sử dụng.
Mã nguồn mở
Theo đúng tinh thần TradingView, tác giả của tập lệnh này đã công bố nó dưới dạng mã nguồn mở, để các nhà giao dịch có thể xem xét và xác minh chức năng. Chúc mừng tác giả! Mặc dù bạn có thể sử dụng miễn phí, hãy nhớ rằng việc công bố lại mã phải tuân theo Nội quy.
Thông báo miễn trừ trách nhiệm
Thông tin và các ấn phẩm này không nhằm mục đích, và không cấu thành, lời khuyên hoặc khuyến nghị về tài chính, đầu tư, giao dịch hay các loại khác do TradingView cung cấp hoặc xác nhận. Đọc thêm tại Điều khoản Sử dụng.