OPEN-SOURCE SCRIPT
Average True Range with MA

Key features
ATR calculation: true range (ta.tr(true)) is smoothed using a selectable method to produce the ATR.
ATR smoothing options: RMA, SMA, EMA, or WMA for the ATR calculation.
MA-on-ATR: a separate moving average computed on the ATR values with its own length and smoothing method.
Display controls: toggles to show/hide the ATR and the ATR MA independently.
Appearance controls: separate color inputs for the ATR and the ATR MA, and a thicker line for the MA (linewidth=2).
Inputs
ATR Length (default 14): length used to smooth true range into the ATR.
ATR Smoothing (default RMA): smoothing method applied to the true range to form ATR.
MA Length (on ATR) (default 14): length for the moving average applied to the ATR series.
MA Smoothing (default SMA): smoothing method used for the MA applied to ATR.
Show ATR / Show ATR MA: booleans to toggle visibility.
ATR Color / ATR MA Color: choose plot colors.
How to interpret
ATR line: shows current volatility (average true range). Rising ATR indicates increasing volatility; falling ATR indicates decreasing volatility.
ATR MA line: smooths the ATR to reveal trend direction and reduce noise.
Use crossovers: ATR crossing above its MA may signal volatility is picking up; ATR crossing below its MA suggests volatility is subsiding.
Combine with price action or other indicators (e.g., breakout systems, position sizing rules) to make decisions based on volatility regime.
ATR calculation: true range (ta.tr(true)) is smoothed using a selectable method to produce the ATR.
ATR smoothing options: RMA, SMA, EMA, or WMA for the ATR calculation.
MA-on-ATR: a separate moving average computed on the ATR values with its own length and smoothing method.
Display controls: toggles to show/hide the ATR and the ATR MA independently.
Appearance controls: separate color inputs for the ATR and the ATR MA, and a thicker line for the MA (linewidth=2).
Inputs
ATR Length (default 14): length used to smooth true range into the ATR.
ATR Smoothing (default RMA): smoothing method applied to the true range to form ATR.
MA Length (on ATR) (default 14): length for the moving average applied to the ATR series.
MA Smoothing (default SMA): smoothing method used for the MA applied to ATR.
Show ATR / Show ATR MA: booleans to toggle visibility.
ATR Color / ATR MA Color: choose plot colors.
How to interpret
ATR line: shows current volatility (average true range). Rising ATR indicates increasing volatility; falling ATR indicates decreasing volatility.
ATR MA line: smooths the ATR to reveal trend direction and reduce noise.
Use crossovers: ATR crossing above its MA may signal volatility is picking up; ATR crossing below its MA suggests volatility is subsiding.
Combine with price action or other indicators (e.g., breakout systems, position sizing rules) to make decisions based on volatility regime.
Skrip sumber terbuka
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.
Penafian
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.
Skrip sumber terbuka
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.
Penafian
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.