Data Analytic Investments
Volatility & BandsBeginner

ATR

Average True Range

Measures market volatility in absolute price terms — the standard yardstick for how far an asset typically moves in a day.

All timeframes
Crypto, Forex, Equities, Commodities
Pine Script v5

What is it?

Developed by J. Welles Wilder Jr. in 1978, ATR measures the average of the 'true range' over a lookback period (default 14). True range is the greatest of: (1) current high minus current low, (2) absolute value of current high minus previous close, (3) absolute value of current low minus previous close. This accounts for overnight gaps and limit moves. ATR does not indicate direction — only volatility magnitude. A rising ATR means volatility is expanding; a falling ATR means it is contracting.

Common pitfalls

  • ATR is not directional. A high ATR tells you the market is moving a lot — not which way. Never use it alone as a buy or sell indication.
  • ATR spikes during news events (CPI, Fed decisions, exchange hacks). A single high-volatility candle can inflate ATR for the entire lookback period.
  • Using a fixed ATR multiplier across all assets is dangerous. BTC's ATR as a percentage of price is very different from a stablecoin's. Always normalise by price (ATR%).
  • ATR on a 1-minute chart is dominated by bid-ask spread noise. It is most meaningful on 1H timeframes and above.
  • Wilder's original ATR uses a smoothed moving average (RMA), not a simple average. Many platforms default to SMA — check which calculation your platform uses.

Free code template

Paste directly into TradingView Pine Editor → Add to chart.

Pine Script v5
/indicator("ATR — DAI Template", shorttitle="DAI ATR", overlay=false)

atrLen = input.int(14, "ATR Length", minval=1)
atrVal = ta.atr(atrLen)
atrPct = atrVal / close * 100
atrAvg = ta.sma(atrVal, 20)
highVol = atrVal > atrAvg * 1.5

plot(atrPct, "ATR%", color = highVol ? #ef4444 : #f59e0b, linewidth=2)
plot(atrAvg / close * 100, "ATR% 20 SMA", color=color.new(#94a3b8, 40), linewidth=1)
bgcolor(highVol ? color.new(#ef4444, 92) : na)
alertcondition(highVol, "High Volatility", "ATR is 1.5x above its 20-period average")