17 — Volatility

Average True Range#

Statistical1 min read
◆ The PatternVolatility as the typical size of a bar, gaps included, the yardstick for stops and position size

The Average True Range — Wilder's volatility measure (1978). Purely measures volatility, NOT direction.

True Range = max(H−L, |H−Prev Close|, |L−Prev Close|)
ATR = Smoothed average of TR over N periods (default 14)
Practical uses:
• Position sizing: Risk 1–2 ATR per trade → adapts to current volatility
• Stop loss: Place stops 1.5–2× ATR from entry
• Volatility filter: High ATR = trending market; low ATR = ranging
Worked example

True range looks at yesterday’s close as well as today’s high and low, so gaps count. Day 13: high 102, low 98, previous close 102, so TR = max(4, 0, 4) = 4. Five-day ATR with Wilder’s smoothing is 3.41 on day 15: the typical bar is about 3.4 points, 3.3% of the price.

The example data: 15 days, used in every indicator here
DayHighLowCloseVolume
11019910050,000
210310010262,000
310310010148,000
410510110470,000
510810410785,000
610810510660,000
711010610990,000
811010710872,000
910810410580,000
1010510210366,000
1110510210455,000
1210410110275,000
13102989995,000
141029910164,000
1510510110471,000
Where it misleads
  • It measures size, not direction; a high ATR comes with rallies and crashes alike.
  • It is in price units. Compare it as a percentage of price across assets or long periods.
  • Wilder’s smoothing is slow: after a shock ATR takes several bars to reflect the new volatility, and as long to forget it.
In code
pc = df['close'].shift()
tr = pd.concat([df['high'] - df['low'], (df['high'] - pc).abs(), (df['low'] - pc).abs()], axis=1).max(axis=1)
df['atr5'] = tr.ewm(alpha=1/5, adjust=False).mean()   # Wilder smoothing
Python, in your browser — edit the code and run it again

Assumes import numpy as np, import pandas as pd, and a DataFrame df with columns high, low, close and volume — the 15 days above.

Sources
  • New Concepts in Technical Trading Systems, J. W. Wilder, Trend Research, 1978
  • C. Faith, Way of the Turtle, McGraw-Hill, 2007 — ATR (“N”) for stops and position size

Last reviewed October 2026 · How this site checks its content · Report a mistake

Check yourself

1. What does the Average True Range measure?

Show answer

B. Wilder designed it for commodities, where limit moves and gaps made the simple high–low range misleading.

2. How does the true range differ from the high minus the low?

Show answer

C. True range is the largest of: high − low, |high − previous close|, |low − previous close|.

3. Why set a stop at, say, 2 × ATR from entry?

Show answer

B. A fixed stop is too tight in volatile markets and too loose in calm ones. No stop guarantees the fill price.

Pattern bridge: Average True Range measures volatility as mean absolute deviation — a close cousin of standard deviation. In ML, gradient clipping uses a similar magnitude threshold.
Linked from 7
← Previous
Bollinger Bands
Open in the full reader, with the topic sidebar