Average True Range (ATR)
StratCraft indicator page for ATR volatility measurement.
Route: /indicators/atr/
What It Does
ATR measures market volatility by averaging the true range over a lookback period. It does not describe direction, only how much price is moving.
Formula
True Range = max(High - Low, |High - Prev Close|, |Low - Prev Close|)
ATR = SmoothedMovingAverage(TrueRange, period) (default period = 14). With a different movav, the selected moving average replaces the smoothed average.
Worked Example
period = 3, illustrative true ranges 2, 3, 4 seed the smoothed average at 3. For the next true range 5: ATR = (3 × 2 + 5) / 3 = 3.67 (rounded).
Parameters
period- default14movav- defaultSmoothedMovingAverage
Backtrader API
import backtrader as bt
atr = bt.indicators.ATR(data, period=14)
Common Usage
- Use ATR for stop-loss sizing.
- Use ATR for volatility filters.
- Combine ATR with breakout or regime logic.
Practical Pattern
When ATR expands, the market is usually moving faster. When ATR contracts, compression may be building before a breakout.
