OPEN-SOURCE SCRIPT
Updated Volatility-Scaled Range Level with Term Structure Filter

WHAT IT DOES
This indicator plots a single volatility-scaled price level and evaluates three independent market-condition filters against it. The level sits one Average True Range below the prior period's close, so it widens automatically when realized volatility expands and tightens when volatility contracts. A summary table reports the level, its distance from current price as a percentage, and the state of each filter.
It is a reference and condition-monitoring tool. It does not generate buy or sell orders, does not connect to a broker, and takes no position on whether any particular trade should be placed.
HOW IT WORKS
The level is computed on a higher timeframe than the chart:
level = close[1] of higher timeframe − ATR(14) of higher timeframe
ATR here is Wilder's RMA of True Range, which is what ta.atr() returns. Both components are pulled with request.security(..., lookahead = barmerge.lookahead_off) and referenced at index [1], so the value is drawn from the last completed higher timeframe bar and does not repaint. Setting the timeframe input to W produces a weekly-anchored level; D produces a daily-anchored one.
The level is then floored to a user-defined increment (default 5). This is optional rounding for users who want the level snapped to a round number rather than an arbitrary decimal.
Three filters are evaluated independently:
Term structure. The ratio of a short-dated volatility index to a longer-dated one (default CBOE:VIX over CBOE:VIX3M). A ratio below the threshold indicates contango, the normal state. A ratio above it indicates backwardation, which historically coincides with volatility clustering and trending decline. Both symbols are user inputs and can be swapped for other instruments.
Absolute volatility floor. A minimum level on the short-dated volatility index. Below this, the distance implied by ATR is small in absolute terms.
Optional trend filter. Price above its 21-period EMA.
The table reads GATES PASS only when all enabled filters are satisfied. An alert() call fires on the first bar of each new higher-timeframe period, with the level, the distance, and the filter states embedded in the message text.
HOW TO USE IT
Add to a daily chart. Set the ATR timeframe input to match the horizon you care about: W for a weekly-anchored level, D for a daily one. Confirm your data plan resolves both volatility symbols; substitute alternatives in the Symbols group if not.
The panel position is adjustable through the "Panel offset right of centre (%)" input, from 0 for centred through 45 for the right edge.
For notifications: right-click the chart, Add alert, select this indicator as the condition, choose "Any alert() function call", and set the frequency to Once Per Bar so it fires at the start of a new period rather than at its close.
The "Anchor on forming period" input switches the level to use the in-progress higher-timeframe bar rather than the last completed one. This produces a value that updates continuously through the period. It is intended as a preview of where the next period's level is forming, not as a signal, and it will change intrabar.
ORIGINALITY
Prior-close-minus-ATR levels are a well-established concept and several published indicators plot them, most notably Saty Mahajan's ATR Levels, which plots a full Fibonacci ladder of them across six timeframe modes. This script is not a republication of that work and does not reuse its code. It differs in scope and purpose:
It plots one level rather than a ladder, to keep the chart readable when the level is the only thing being monitored.
It adds volatility term structure and absolute volatility as explicit gating conditions, which existing ATR level indicators do not evaluate.
It rounds the level to a user-defined increment.
It emits a dynamic alert message containing the computed values, so the notification is self-contained and requires no chart lookup.
The arithmetic that produces the level is standard and deliberately matches the conventional definition so that values are comparable with other implementations.
LIMITATIONS AND SHORTCOMINGS
The level is descriptive, not predictive. It describes a distance in volatility units. Price reaching or not reaching it carries no guarantee of any kind.
The term structure filter depends on external symbols. If your data plan does not provide them, the filter cannot be evaluated and the table will not populate correctly. Verify both symbols resolve before relying on it.
Volatility index data is daily. The filter therefore updates on a slower cadence than the chart and can be stale relative to fast intraday moves.
The absolute volatility floor is a coarse proxy. It says nothing about the actual pricing of any instrument.
On index CFD feeds, the underlying value can differ slightly from the cash index. Where the level is near a rounding boundary, the rounded output may differ between feeds.
The forming-period preview mode updates continuously and is not a fixed reference.
No backtest or performance statistics are presented, because this is an indicator and not a strategy. Nothing here has been tested as a system.
CREDITS
The prior-close-minus-ATR level concept is widely used. Saty Mahajan's open-source ATR Levels indicator is the best-known implementation on TradingView and is worth reviewing for a fuller treatment of the concept across multiple timeframe modes and Fibonacci ratios.
DISCLAIMER
This script is provided for educational and analytical purposes. It is not financial, investment, or trading advice, and it is not a recommendation to buy or sell anything. Volatility-based levels describe historical range behaviour and carry no predictive guarantee. Any use of this tool is at your own risk.# TradingView publication description
This indicator plots a single volatility-scaled price level and evaluates three independent market-condition filters against it. The level sits one Average True Range below the prior period's close, so it widens automatically when realized volatility expands and tightens when volatility contracts. A summary table reports the level, its distance from current price as a percentage, and the state of each filter.
It is a reference and condition-monitoring tool. It does not generate buy or sell orders, does not connect to a broker, and takes no position on whether any particular trade should be placed.
HOW IT WORKS
The level is computed on a higher timeframe than the chart:
level = close[1] of higher timeframe − ATR(14) of higher timeframe
ATR here is Wilder's RMA of True Range, which is what ta.atr() returns. Both components are pulled with request.security(..., lookahead = barmerge.lookahead_off) and referenced at index [1], so the value is drawn from the last completed higher timeframe bar and does not repaint. Setting the timeframe input to W produces a weekly-anchored level; D produces a daily-anchored one.
The level is then floored to a user-defined increment (default 5). This is optional rounding for users who want the level snapped to a round number rather than an arbitrary decimal.
Three filters are evaluated independently:
Term structure. The ratio of a short-dated volatility index to a longer-dated one (default CBOE:VIX over CBOE:VIX3M). A ratio below the threshold indicates contango, the normal state. A ratio above it indicates backwardation, which historically coincides with volatility clustering and trending decline. Both symbols are user inputs and can be swapped for other instruments.
Absolute volatility floor. A minimum level on the short-dated volatility index. Below this, the distance implied by ATR is small in absolute terms.
Optional trend filter. Price above its 21-period EMA.
The table reads GATES PASS only when all enabled filters are satisfied. An alert() call fires on the first bar of each new higher-timeframe period, with the level, the distance, and the filter states embedded in the message text.
HOW TO USE IT
Add to a daily chart. Set the ATR timeframe input to match the horizon you care about: W for a weekly-anchored level, D for a daily one. Confirm your data plan resolves both volatility symbols; substitute alternatives in the Symbols group if not.
The panel position is adjustable through the "Panel offset right of centre (%)" input, from 0 for centred through 45 for the right edge.
For notifications: right-click the chart, Add alert, select this indicator as the condition, choose "Any alert() function call", and set the frequency to Once Per Bar so it fires at the start of a new period rather than at its close.
The "Anchor on forming period" input switches the level to use the in-progress higher-timeframe bar rather than the last completed one. This produces a value that updates continuously through the period. It is intended as a preview of where the next period's level is forming, not as a signal, and it will change intrabar.
ORIGINALITY
Prior-close-minus-ATR levels are a well-established concept and several published indicators plot them, most notably Saty Mahajan's ATR Levels, which plots a full Fibonacci ladder of them across six timeframe modes. This script is not a republication of that work and does not reuse its code. It differs in scope and purpose:
It plots one level rather than a ladder, to keep the chart readable when the level is the only thing being monitored.
It adds volatility term structure and absolute volatility as explicit gating conditions, which existing ATR level indicators do not evaluate.
It rounds the level to a user-defined increment.
It emits a dynamic alert message containing the computed values, so the notification is self-contained and requires no chart lookup.
The arithmetic that produces the level is standard and deliberately matches the conventional definition so that values are comparable with other implementations.
LIMITATIONS AND SHORTCOMINGS
The level is descriptive, not predictive. It describes a distance in volatility units. Price reaching or not reaching it carries no guarantee of any kind.
The term structure filter depends on external symbols. If your data plan does not provide them, the filter cannot be evaluated and the table will not populate correctly. Verify both symbols resolve before relying on it.
Volatility index data is daily. The filter therefore updates on a slower cadence than the chart and can be stale relative to fast intraday moves.
The absolute volatility floor is a coarse proxy. It says nothing about the actual pricing of any instrument.
On index CFD feeds, the underlying value can differ slightly from the cash index. Where the level is near a rounding boundary, the rounded output may differ between feeds.
The forming-period preview mode updates continuously and is not a fixed reference.
No backtest or performance statistics are presented, because this is an indicator and not a strategy. Nothing here has been tested as a system.
CREDITS
The prior-close-minus-ATR level concept is widely used. Saty Mahajan's open-source ATR Levels indicator is the best-known implementation on TradingView and is worth reviewing for a fuller treatment of the concept across multiple timeframe modes and Fibonacci ratios.
DISCLAIMER
This script is provided for educational and analytical purposes. It is not financial, investment, or trading advice, and it is not a recommendation to buy or sell anything. Volatility-based levels describe historical range behaviour and carry no predictive guarantee. Any use of this tool is at your own risk.# TradingView publication description
Release Notes
Corrected the higher-timeframe level calculation. The anchor close and ATR are now retrieved with a [1] offset paired with lookahead_on, so both lock to the last completed period and remain fixed for its duration rather than recomputing from the forming bar. The higher-timeframe request now uses the extended session, which changes the period OHLC and therefore the ATR value. Added a verification row showing the anchor close and ATR so values can be checked directly against other implementations of this level. The optional forming-period preview is suppressed on historical bars.Release Notes
Update the default viewOpen-source script
In true TradingView spirit, the creator of this script has made it open-source, so that traders can review and verify its functionality. Kudos to the author! While you can use it for free, remember that republishing the code is subject to our House Rules.
Disclaimer
The information and publications are not meant to be, and do not constitute, financial, investment, trading, or other types of advice or recommendations supplied or endorsed by TradingView. Read more in the Terms of Use.
Open-source script
In true TradingView spirit, the creator of this script has made it open-source, so that traders can review and verify its functionality. Kudos to the author! While you can use it for free, remember that republishing the code is subject to our House Rules.
Disclaimer
The information and publications are not meant to be, and do not constitute, financial, investment, trading, or other types of advice or recommendations supplied or endorsed by TradingView. Read more in the Terms of Use.