Skip to content

What (One-liner)

ATR Average True Range (14-day Wilder RMA), core for position sizing / stop-loss.

How to use

python
from services.algo.technical import compute_atr
atr = compute_atr(high, low, close, period=14)

Core formulas

TR_t = max(high_t - low_t, |high_t - close_{t-1}|, |low_t - close_{t-1}|)
ATR_t = pandas EWM(alpha=1/14, adjust=False, min_periods=14).mean() of TR

Assumptions & applicability

Assumptions: OHLC complete + Wilder RMA (α=1/period) + TR takes max of three.

Applicable: position sizing, trailing stop, volatility breakout.

Not applicable: only close, tick, short series.

Known limitations

  1. Wilder RMA vs EMA/SMA difference (defaults vary across different charting software)
  2. 14-day default
  3. pandas-ta version dependency

References

Wilder (1978) original.

Golden Test

tests/golden/fixtures/tier1/compute_atr/, 1e-10, 2026-04-20 passing.

Changelog

  • 1.0.0 (2026-04-20) — First Active

Verifiable intelligence for the decisions that demand scrutiny.