OPEN-SOURCE SCRIPT
Updated

ATR % V3

90
Now I'll provide you with the fully translated script and comprehensive documentation:

ATR % V3 Indicator - Introduction
The ATR % V3 is a Pine Script indicator that displays the Average True Range (ATR) as a percentage of price, providing traders with a normalized view of market volatility. Unlike the standard ATR which shows absolute price values, this percentage-based approach allows for easier comparison across different securities and timeframes. The indicator includes advanced features such as multi-day extreme value detection, customizable horizontal reference lines, and optional coordinate inversion for specialized charting needs.

Key Features
Percentage-based ATR calculation relative to either current open or previous close

Flexible smoothing methods (RMA, SMA, EMA, WMA) for different trading styles

Multi-period extreme value markers for 3-day and 7-day highs/lows

Dynamic horizontal reference line showing current ATR% value

Optional coordinate flip for alternative visualization perspectives

Bar confirmation control to prevent repainting on live bars

Technical Explanation
ATR Percentage Calculation
The script calculates ATR% using the formula: ATR% = (ATR / Basis Price) × 100. The basis price can be either the current bar's open price or the previous bar's close price, allowing traders to choose the reference point that best suits their trading methodology.

Smoothing Methods
The indicator supports four moving average types for ATR smoothing:


RMA (Relative Moving Average): Default method, provides exponentially smoothed values similar to Wilder's original ATR implementation

SMA (Simple Moving Average): Equal weighting of all periods

EMA (Exponential Moving Average): Recent prices weighted more heavily

WMA (Weighted Moving Average): Linear weighting scheme

Extreme Value Detection
The script identifies when the current ATR% value represents a local extreme over 3-day or 7-day lookback periods. These markers appear only on the most recent bar and help traders identify volatility compression or expansion zones that may precede significant price moves.


Anti-Repainting Feature
The "Wait for Bar Close to Update" option prevents the indicator from recalculating on every tick within an unconfirmed bar. When enabled, the ATR% value updates only after each bar closes, ensuring consistent historical values that won't change retroactively.


Usage Recommendations
For Volatility Analysis: Use the percentage-based approach to compare volatility across different assets or timeframes objectively. Higher ATR% values indicate increased volatility relative to price.


For Position Sizing: ATR% can inform position size adjustments—reduce exposure when volatility (ATR%) spikes, and potentially increase when volatility contracts.


For Stop Loss Placement: The horizontal reference line provides a quick visual reference for current volatility levels, useful for setting volatility-adjusted stop losses.


For Breakout Confirmation: Watch for 3-day or 7-day extreme markers—volatility extremes often precede or confirm trend reversals or breakouts.
Release Notes
ATR Percentage Indicator - Percentage-Based Volatility Analysis
The ATR % V3 is a sophisticated Pine Script indicator that transforms the traditional Average True Range (ATR) into a percentage format, making it a universal volatility measurement tool. By expressing volatility as a percentage of price rather than absolute points, this indicator enables direct comparison across different securities, price levels, and timeframes—something impossible with standard ATR values.

Why Percentage Matters
Cross-Asset Comparison: A $5 ATR means very different things for a $10 stock versus a $500 stock. ATR % solves this by normalizing volatility—both might show 2.5% ATR, revealing identical relative volatility despite vastly different price levels.

Historical Consistency: As asset prices grow or decline over time, raw ATR values become incomparable across different periods. The percentage-based approach maintains consistent interpretation regardless of price evolution, making historical volatility analysis meaningful.

Universal Benchmarking: With ATR %, you can directly compare the volatility of stocks, forex pairs, cryptocurrencies, and commodities on the same scale. A 3% ATR value represents the same relative volatility whether you're analyzing Bitcoin, gold, or tech stocks.

Core Features
Percentage Calculation Options
Current Open Basis: Calculates ATR as a percentage of the current bar's opening price

Previous Close Basis: Uses the previous bar's closing price as the denominator, providing continuity with prior price action

Advanced Percentage Display
Coordinate Flip Option: Inverts the percentage scale (multiplies by -1) for alternative visualization perspectives

Dynamic Horizontal Line: Displays the current ATR % value as a reference line extending across the entire chart

Multiple Smoothing Methods: RMA, SMA, EMA, or WMA for different percentage calculation sensitivities

Percentage-Based Extreme Detection
3-Day High/Low Markers: Identifies when current ATR % reaches 3-day extremes, highlighting short-term volatility spikes or contractions

7-Day High/Low Markers: Flags weekly volatility extremes, useful for detecting significant regime changes in percentage terms

Percentage-Based Trading Applications
Normalized Position Sizing: Use ATR % thresholds (e.g., reduce size when ATR % > 5%, increase when < 2%) consistently across your entire portfolio, regardless of individual asset prices.

Volatility Regime Identification: Define percentage-based volatility regimes—low (<1.5%), normal (1.5-3%), high (3-5%), extreme (>5%)—applicable to any traded instrument.

Comparative Analysis: Identify which assets in your watchlist are experiencing relatively higher or lower volatility by comparing their ATR % values directly.

Risk-Adjusted Stop Losses: Set stop losses as multiples of ATR % (e.g., 1.5× current ATR %) that automatically adjust to each asset's relative volatility level.

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.