OPEN-SOURCE SCRIPT
Trading ATR Framework

# Trading ATR Framework
**Trading ATR Framework** is a rule-based volatility and market-location tool designed primarily for intraday futures trading.
The purpose of the indicator is not to generate automatic buy or sell signals. Instead, it provides a structured way to measure how far the current market has moved relative to its recent daily volatility and to identify predefined volatility expansion zones.
## Core Concept
The framework uses two main reference values:
1. **Previous Daily Close**
The previous completed trading day's close is used as the default reference price.
2. **Daily ATR(14)**
The indicator calculates the Average True Range over the last 14 completed daily bars. ATR measures the average daily price range and is used as a volatility reference.
From these two values, the indicator projects symmetrical volatility levels above and below the reference price.
The calculated levels are:
* +25% ATR
* +50% ATR
* +75% ATR
* +100% ATR
* -25% ATR
* -50% ATR
* -75% ATR
* -100% ATR
For example, if the previous daily close is 20,000 and the completed Daily ATR(14) is 400 points, the +25% ATR level would be:
**20,000 + (400 × 0.25) = 20,100**
The -50% ATR level would be:
**20,000 - (400 × 0.50) = 19,800**
This creates a standardized volatility map around the previous session's closing price.
## Why I Created This Framework
Many intraday traders evaluate price levels without considering how far the market has already travelled relative to its normal daily volatility.
This framework combines:
* previous-session price anchoring,
* completed Daily ATR volatility,
* fractional ATR expansion levels,
* tick-size normalization,
* directional location,
* and risk-to-reward calculations
into one visual framework.
The goal is to make market location more objective.
Instead of simply asking whether price is bullish or bearish, traders can evaluate questions such as:
* Is price still close to the previous daily close?
* Has the market already expanded 50% of its normal daily ATR?
* Is price approaching a 75% or 100% ATR expansion?
* Is a potential entry occurring early or late within the current volatility expansion?
* Does the available distance to the next relevant level justify the risk?
## Directional Context
The indicator also displays the current position of price relative to the ATR framework.
Price trading above the reference close indicates positive expansion, while price trading below the reference close indicates negative expansion.
This directional information is intended as **market context**, not as an automatic trend or trade signal.
A market trading above +50% ATR, for example, is in a very different volatility location than a market trading only +10% above the previous close.
The trader can use this information together with market structure to determine whether the market is:
* expanding,
* consolidating,
* approaching an extended volatility area,
* or returning toward its reference price.
## How to Use the Indicator
A typical workflow is:
**1. Identify market direction and structure**
Evaluate the broader session structure, previous highs and lows, trend direction, consolidation areas, or other structural references.
**2. Check the current ATR position**
Determine where price is currently located relative to the previous daily close and the projected ATR levels.
**3. Evaluate volatility expansion**
Consider whether the market is still in an early expansion area such as 25% ATR or has already reached a more extended area such as 75% or 100% ATR.
**4. Look for confirmation**
ATR levels are not intended to be traded mechanically.
They can be combined with tools such as:
* price action,
* support and resistance,
* volume,
* volume profile,
* order flow,
* footprint charts,
* delta,
* liquidity,
* session highs and lows,
* or other trader-defined confirmation methods.
**5. Evaluate risk-to-reward**
The built-in risk-to-reward tool can be used to compare the intended stop distance with a target based on a 2.5R reward-to-risk relationship.
## Tick-Size Normalization
ATR calculations can produce prices that do not correspond exactly to the minimum tick size of a futures contract.
The indicator therefore rounds calculated ATR levels to the instrument's valid tick size.
This makes the projected levels easier to use with futures contracts such as:
* NQ / MNQ
* GC / MGC
* CL / MCL
The framework can also be applied to other instruments where ATR-based volatility mapping is useful.
## Manual Reference Mode
By default, the framework uses the automatically calculated previous daily close and Daily ATR(14).
Optional manual inputs allow traders to override:
* the reference/settlement price,
* and the ATR value.
This can be useful when a trader wants to work with an exchange settlement value, an externally calculated ATR value, or another manually defined session reference.
## Risk-to-Reward Calculator
The indicator includes a simple **2.5R risk-to-reward calculation**.
This feature is intended to help traders evaluate whether sufficient price space exists between a potential entry, stop level, and target.
It is a planning tool and does not automatically determine whether a trade should be taken.
## Alerts
Alerts can be configured for important ATR level crossings.
This allows traders to monitor when price enters or crosses predefined volatility expansion zones without continuously watching the chart.
## Intended Markets
The framework was primarily developed for intraday futures markets, especially:
**Nasdaq**
NQ / MNQ
**Gold**
GC / MGC
**Crude Oil**
CL / MCL
However, because the calculations are based on price and ATR rather than instrument-specific signals, the framework can also be applied to other liquid markets.
## Important Interpretation
ATR measures volatility, not direction.
Reaching +75% ATR does not automatically mean price should reverse.
Likewise, reaching -100% ATR does not automatically mean a market should be bought.
Strong directional markets can continue beyond a full Daily ATR.
The ATR levels should therefore be interpreted as **volatility and decision zones rather than standalone entry signals**.
The framework is designed to answer:
**"Where is the market currently trading relative to its normal daily volatility?"**
The final trading decision remains dependent on market structure, confirmation, execution rules, and risk management.
**Trading ATR Framework** is a rule-based volatility and market-location tool designed primarily for intraday futures trading.
The purpose of the indicator is not to generate automatic buy or sell signals. Instead, it provides a structured way to measure how far the current market has moved relative to its recent daily volatility and to identify predefined volatility expansion zones.
## Core Concept
The framework uses two main reference values:
1. **Previous Daily Close**
The previous completed trading day's close is used as the default reference price.
2. **Daily ATR(14)**
The indicator calculates the Average True Range over the last 14 completed daily bars. ATR measures the average daily price range and is used as a volatility reference.
From these two values, the indicator projects symmetrical volatility levels above and below the reference price.
The calculated levels are:
* +25% ATR
* +50% ATR
* +75% ATR
* +100% ATR
* -25% ATR
* -50% ATR
* -75% ATR
* -100% ATR
For example, if the previous daily close is 20,000 and the completed Daily ATR(14) is 400 points, the +25% ATR level would be:
**20,000 + (400 × 0.25) = 20,100**
The -50% ATR level would be:
**20,000 - (400 × 0.50) = 19,800**
This creates a standardized volatility map around the previous session's closing price.
## Why I Created This Framework
Many intraday traders evaluate price levels without considering how far the market has already travelled relative to its normal daily volatility.
This framework combines:
* previous-session price anchoring,
* completed Daily ATR volatility,
* fractional ATR expansion levels,
* tick-size normalization,
* directional location,
* and risk-to-reward calculations
into one visual framework.
The goal is to make market location more objective.
Instead of simply asking whether price is bullish or bearish, traders can evaluate questions such as:
* Is price still close to the previous daily close?
* Has the market already expanded 50% of its normal daily ATR?
* Is price approaching a 75% or 100% ATR expansion?
* Is a potential entry occurring early or late within the current volatility expansion?
* Does the available distance to the next relevant level justify the risk?
## Directional Context
The indicator also displays the current position of price relative to the ATR framework.
Price trading above the reference close indicates positive expansion, while price trading below the reference close indicates negative expansion.
This directional information is intended as **market context**, not as an automatic trend or trade signal.
A market trading above +50% ATR, for example, is in a very different volatility location than a market trading only +10% above the previous close.
The trader can use this information together with market structure to determine whether the market is:
* expanding,
* consolidating,
* approaching an extended volatility area,
* or returning toward its reference price.
## How to Use the Indicator
A typical workflow is:
**1. Identify market direction and structure**
Evaluate the broader session structure, previous highs and lows, trend direction, consolidation areas, or other structural references.
**2. Check the current ATR position**
Determine where price is currently located relative to the previous daily close and the projected ATR levels.
**3. Evaluate volatility expansion**
Consider whether the market is still in an early expansion area such as 25% ATR or has already reached a more extended area such as 75% or 100% ATR.
**4. Look for confirmation**
ATR levels are not intended to be traded mechanically.
They can be combined with tools such as:
* price action,
* support and resistance,
* volume,
* volume profile,
* order flow,
* footprint charts,
* delta,
* liquidity,
* session highs and lows,
* or other trader-defined confirmation methods.
**5. Evaluate risk-to-reward**
The built-in risk-to-reward tool can be used to compare the intended stop distance with a target based on a 2.5R reward-to-risk relationship.
## Tick-Size Normalization
ATR calculations can produce prices that do not correspond exactly to the minimum tick size of a futures contract.
The indicator therefore rounds calculated ATR levels to the instrument's valid tick size.
This makes the projected levels easier to use with futures contracts such as:
* NQ / MNQ
* GC / MGC
* CL / MCL
The framework can also be applied to other instruments where ATR-based volatility mapping is useful.
## Manual Reference Mode
By default, the framework uses the automatically calculated previous daily close and Daily ATR(14).
Optional manual inputs allow traders to override:
* the reference/settlement price,
* and the ATR value.
This can be useful when a trader wants to work with an exchange settlement value, an externally calculated ATR value, or another manually defined session reference.
## Risk-to-Reward Calculator
The indicator includes a simple **2.5R risk-to-reward calculation**.
This feature is intended to help traders evaluate whether sufficient price space exists between a potential entry, stop level, and target.
It is a planning tool and does not automatically determine whether a trade should be taken.
## Alerts
Alerts can be configured for important ATR level crossings.
This allows traders to monitor when price enters or crosses predefined volatility expansion zones without continuously watching the chart.
## Intended Markets
The framework was primarily developed for intraday futures markets, especially:
**Nasdaq**
NQ / MNQ
**Gold**
GC / MGC
**Crude Oil**
CL / MCL
However, because the calculations are based on price and ATR rather than instrument-specific signals, the framework can also be applied to other liquid markets.
## Important Interpretation
ATR measures volatility, not direction.
Reaching +75% ATR does not automatically mean price should reverse.
Likewise, reaching -100% ATR does not automatically mean a market should be bought.
Strong directional markets can continue beyond a full Daily ATR.
The ATR levels should therefore be interpreted as **volatility and decision zones rather than standalone entry signals**.
The framework is designed to answer:
**"Where is the market currently trading relative to its normal daily volatility?"**
The final trading decision remains dependent on market structure, confirmation, execution rules, and risk management.
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.