Average True Range
The Average True Range (ATR) is a foundational volatility indicator that measures the average amount of price movement over a specified period. Unlike percentage-based volatility measures, ATR provides an absolute value that represents typical price movement, making it invaluable for risk management and position sizing. It smooths the True Range values using a moving average, providing a clearer picture of overall market volatility trends.
Developed by J. Welles Wilder Jr. and introduced in his 1978 book "New Concepts in Technical Trading Systems," ATR has become one of the most widely used volatility indicators in technical analysis. Wilder originally used a 14-period calculation, which remains the standard default today.
What It Measures
The Average True Range measures the average absolute price movement over a specified number of periods, providing a volatility metric that accounts for gaps and limit moves. Higher ATR values indicate greater volatility and larger price swings, while lower values suggest calmer, more stable price action.
When to Use
- Position Sizing: Scale position sizes inversely with ATR to maintain consistent risk across varying volatility levels
- Stop Loss Placement: Set stop losses at multiples of ATR (e.g., 2× or 3× ATR) to avoid being stopped out by normal volatility
- Volatility Assessment: Compare current ATR to historical levels to identify expansion or contraction in volatility
- Breakout Confirmation: Rising ATR can confirm the strength of price breakouts or trend changes
- Risk Management: Use ATR to adjust trading strategies based on current market conditions
- Trailing Stops: Dynamic trailing stops based on ATR multiples adapt to changing market volatility
Period Selection Guidelines
The period parameter affects how responsive the ATR is to recent volatility changes:
| Period Range | Characteristics | Use Case |
|---|---|---|
| 5-10 | Highly responsive, captures short-term volatility | Day trading, scalping, quick adjustments |
| 10-14 | Standard (Wilder's default: 14) | General trading, balanced view |
| 14-20 | Moderate smoothing | Swing trading, medium-term positions |
| 20-30 | Smoother, filters short-term spikes | Position trading, trend following |
| 30-50+ | Very smooth, long-term volatility trends | Long-term investing, strategic allocation |
Model Selection
ATR supports different averaging methods for smoothing True Range values:
- Simple Moving Average (SMA): Equal weight to all periods, easiest to interpret
- Exponential Moving Average (EMA): More weight to recent values, more responsive
- Smoothed Moving Average (SMMA): Wilder's original method, very smooth, commonly used
- Simple Moving Median: Uses median instead of mean, more robust to outliers
- Simple Moving Mode: Uses mode (most frequent value), useful for discrete or clustered data
Wilder originally used the Smoothed Moving Average (SMMA) method, which gives very gradual weight changes and is the traditional choice for ATR calculations.
Interpretation
- Rising ATR: Indicates increasing volatility; markets are becoming more active and price swings are expanding
- Falling ATR: Suggests decreasing volatility; markets are calmer with smaller price movements
- High ATR Values: Large price movements are typical; wider stops and larger position adjustments may be needed
- Low ATR Values: Price movements are constrained; tighter stops and different strategies may be appropriate
- ATR Spikes: Sudden increases often coincide with major news events, breakouts, or trend reversals
- ATR Trend: A rising ATR trend during an uptrend or downtrend confirms trend strength
- Absolute vs Relative: Compare ATR to the asset's price to understand relative volatility (ATR/Price ratio)
Default Usage
use rust_ti::other_indicators::bulk::average_true_range;
use rust_ti::ConstantModelType;
pub fn main() {
// fetch the data in your preferred way
// let close = vec![...]; // close prices
// let high = vec![...]; // high prices
// let low = vec![...]; // low prices
let period = 14;
let model = ConstantModelType::SimpleMovingAverage;
let atr = average_true_range(&close, &high, &low, model, period);
println!("ATR: {:?}", atr);
}
import pytechnicalindicators as pti
# Average True Range with default parameters
period = 14
model = "simple_moving_average"
atr = pti.other_indicators.bulk.average_true_range(close, high, low, model, period)
print("ATR:", atr)
import init, {
other_bulk_averageTrueRange,
ConstantModelType
} from 'https://cdn.jsdelivr.net/npm/ti-engine@latest/dist/web/ti_engine.js';
await init();
// fetch the data in your preferred way
// const close = [...]; // close prices
// const high = [...]; // high prices
// const low = [...]; // low prices
const period = 14;
const model = ConstantModelType.SimpleMovingAverage;
const atr = other_bulk_averageTrueRange(close, high, low, model, period);
console.log("ATR:", atr);
Interactive Chart
Use the interactive playground below to explore how different parameters affect the indicator's behavior.