OPEN-SOURCE SCRIPT
DTR & ATR with live zones

This indicator is designed to help traders gauge the day's volatility in real-time. It compares the current Daily True Range (DTR)—the distance between the session's high and low—to the historical Average True Range (ATR).
The main purpose is to project potential price levels where the market might reach based on its average volatility. These levels (100% ATR, 150%, 200%, etc.) can be used as price targets. For instance, if you're in a long trade, you might consider taking partial or full profits as the price approaches these upper ATR extension levels. The indicator is highly customisable, allowing you to control the appearance of the ATR lines, zones, and labels to fit your charting preferences.
Core Concepts: ATR and DTR
To use this indicator effectively, it's important to understand its two main components:
The indicator's logic revolves around comparing the live, unfolding DTR to the historical, baseline ATR. An on-screen table conveniently shows this comparison as a percentage, to show how volatile the day has been.
How It Works: The Dynamic & Locked Mechanism
The most clever part of this indicator is how it draws the ATR levels. It operates in two distinct phases during the trading session:
Phase 1: Dynamic Expansion (Before DTR meets ATR)
At the start of the session, the DTR is small. The indicator calculates the remaining range needed to "complete" the 100% ATR level (difference = avg_atr - dtr). It then adds this remaining amount to the session high and subtracts it from the session low. This creates a "floating" 100% ATR range that expands dynamically as the session high or low is extended.
Phase 2: The Lock-in (After DTR meets or exceeds ATR)
Once the day's range (DTR) becomes equal to or greater than the avg_atr, the day has met its "expected" volatility. At this point, the levels lock in place. The indicator intelligently determines the anchor point for the locked range.
Once this primary 100% ATR range is established (either dynamically or locked), the script projects the other levels (150%, 200%, 250%, and 300%) by adding or subtracting multiples of the avg_atr from this base.
How to Use It for Trading
The primary use of this indicator is to set logical, volatility-based price targets.
Setting Profit Targets: If you enter a long position, the upper ATR levels (100%, 150%, 200%) serve as excellent areas to consider taking profits. A move to the 200% or 250% level often signifies an overextended or "exhaustion" move, making it a high-probability exit zone. For short positions, the lower ATR levels serve the same purpose.
Assessing Intraday Momentum: The on-screen table tells you how much of the expected daily range has been used. If it's early in the session and the DTR is only at 30% of the ATR, you can anticipate more significant price movement is likely to come. Conversely, if the DTR is already at 150% of ATR, the bulk of the day's move may already be complete.
Mean Reversion Signals: If the price pushes to an extreme level (e.g., 250% ATR) and shows signs of stalling (e.g., bearish divergence on an oscillator), it could signal a potential reversal or pullback, offering an opportunity for a counter-trend trade.
Key Settings
The main purpose is to project potential price levels where the market might reach based on its average volatility. These levels (100% ATR, 150%, 200%, etc.) can be used as price targets. For instance, if you're in a long trade, you might consider taking partial or full profits as the price approaches these upper ATR extension levels. The indicator is highly customisable, allowing you to control the appearance of the ATR lines, zones, and labels to fit your charting preferences.
Core Concepts: ATR and DTR
To use this indicator effectively, it's important to understand its two main components:
- Average True Range (ATR): This is a classic technical analysis indicator that measures market volatility. It calculates the average range of price movement over a specific period (e.g., 14 days). A higher ATR means the price is, on average, moving more, while a low ATR indicates less volatility. This script uses a higher timeframe ATR (e.g., Daily) to establish a stable volatility baseline for the current trading day.
- Daily True Range (DTR): This is simply the difference between the current trading session's highest high and lowest low (session high - session low). It tells you how much the price has actually moved so far today.
The indicator's logic revolves around comparing the live, unfolding DTR to the historical, baseline ATR. An on-screen table conveniently shows this comparison as a percentage, to show how volatile the day has been.
How It Works: The Dynamic & Locked Mechanism
The most clever part of this indicator is how it draws the ATR levels. It operates in two distinct phases during the trading session:
Phase 1: Dynamic Expansion (Before DTR meets ATR)
At the start of the session, the DTR is small. The indicator calculates the remaining range needed to "complete" the 100% ATR level (difference = avg_atr - dtr). It then adds this remaining amount to the session high and subtracts it from the session low. This creates a "floating" 100% ATR range that expands dynamically as the session high or low is extended.
Phase 2: The Lock-in (After DTR meets or exceeds ATR)
Once the day's range (DTR) becomes equal to or greater than the avg_atr, the day has met its "expected" volatility. At this point, the levels lock in place. The indicator intelligently determines the anchor point for the locked range.
Once this primary 100% ATR range is established (either dynamically or locked), the script projects the other levels (150%, 200%, 250%, and 300%) by adding or subtracting multiples of the avg_atr from this base.
How to Use It for Trading
The primary use of this indicator is to set logical, volatility-based price targets.
Setting Profit Targets: If you enter a long position, the upper ATR levels (100%, 150%, 200%) serve as excellent areas to consider taking profits. A move to the 200% or 250% level often signifies an overextended or "exhaustion" move, making it a high-probability exit zone. For short positions, the lower ATR levels serve the same purpose.
Assessing Intraday Momentum: The on-screen table tells you how much of the expected daily range has been used. If it's early in the session and the DTR is only at 30% of the ATR, you can anticipate more significant price movement is likely to come. Conversely, if the DTR is already at 150% of ATR, the bulk of the day's move may already be complete.
Mean Reversion Signals: If the price pushes to an extreme level (e.g., 250% ATR) and shows signs of stalling (e.g., bearish divergence on an oscillator), it could signal a potential reversal or pullback, offering an opportunity for a counter-trend trade.
Key Settings
- ATR Length & Smoothing Type: These settings control how the baseline ATR is calculated. The default 14 period and RMA smoothing are standard, but you can adjust them to your preference.
- Session Settings: This is crucial. You must set the Market Session and Time Zone to match the primary trading hours of the asset you are analysing (e.g., "0930-1600" for the NYSE session).
- Show Lines / Show Labels / Show Zones: The script gives you full control over the visual display. You can toggle each ATR level's lines, labels, and background zones individually to avoid a cluttered chart and focus only on the levels that matter to your strategy.
开源脚本
本着TradingView的真正精神,此脚本的创建者将其开源,以便交易者可以查看和验证其功能。向作者致敬!虽然您可以免费使用它,但请记住,重新发布代码必须遵守我们的网站规则。
免责声明
这些信息和出版物并不意味着也不构成TradingView提供或认可的金融、投资、交易或其它类型的建议或背书。请在使用条款阅读更多信息。
开源脚本
本着TradingView的真正精神,此脚本的创建者将其开源,以便交易者可以查看和验证其功能。向作者致敬!虽然您可以免费使用它,但请记住,重新发布代码必须遵守我们的网站规则。
免责声明
这些信息和出版物并不意味着也不构成TradingView提供或认可的金融、投资、交易或其它类型的建议或背书。请在使用条款阅读更多信息。