ATR Calculator (Average True Range)
Calculate Average True Range from high, low, and previous close using Wilder's smoothing.
Used for stops, position sizing, and volatility analysis.
Wilder published ATR in 1978 in the same book as RSI. It measures volatility, not direction. The True Range for one bar is the largest of three values:
- Current High - Current Low
- |Current High - Previous Close|
- |Current Low - Previous Close|
The second and third options handle gaps. If a stock closes at $100 and gaps open at $103 with a $103-$104 range, the simple high-low is only $1 but the true range is $4 — which is what actually happened.
ATR is the smoothed average of TR. Wilder uses his own smoothing, not a simple or exponential average:
ATR_today = ((ATR_yesterday × (N - 1)) + TR_today) / N
Default N is 14. The first ATR value is just a 14-period simple average of TR; everything after uses the recursive formula.
Why traders care.
- Stop placement: a “2× ATR stop” puts your stop loss outside the typical daily noise. If ATR is $1.50, you set a $3 stop. Too tight = stopped out by random wiggle. Too wide = bigger losers.
- Position sizing: dollars at risk / (stop distance) gives share count. ATR-based stops convert directly into a position size.
- Volatility comparison: a stock with ATR of $0.20 trades very differently from one with $5.00, regardless of the share price.
- Trend filter: ATR rising = expanding volatility, often during breakouts. ATR contracting = consolidation.
ATR is in absolute price, not percent. A $200 stock with ATR $4 is way less volatile than a $20 stock with ATR $1.50. To compare across stocks, compute ATR/price (the “ATR percent”). 1.5 to 3% per day is normal for liquid US equities.
Worked example. Yesterday’s ATR was 1.40. Today High = 102.50, Low = 100.20, prev Close = 101.80.
- TR = max(2.30, 0.70, 1.60) = 2.30
- ATR_today = ((1.40 × 13) + 2.30) / 14 = (18.20 + 2.30) / 14 = 1.46
Volatility ticked up slightly. Set today’s stop at 2 × 1.46 = $2.92 from entry.