Skip to content
All library documents

Computing ATR with True Range and Wilder-Style Smoothing

Article FMZ forum · Author: syue

Summary

The document presents a hand-written Average True Range calculation and asks for an equivalent implementation using pandas without a technical-analysis library. For the first record, true range is the high minus the low. For later records, it is the greatest of the current high-low range and the absolute gaps between the prior close and either current extreme.

The function initializes ATR as a cumulative average during the first period, then updates it recursively by weighting the prior ATR by period minus one and adding the current true range before dividing by the period. This describes an ATR-like smoothed volatility measure, but provides no example output, comparison, or performance evidence. Its behavior depends on ordered records with high, low, and close values; the snippet also assumes a nonempty input has a close field and does not discuss missing data or pandas-specific indexing details.

Key ideas

  • True range includes both the intraday high-low span and gaps from the previous close.
  • The first bar uses its high-low span because no previous close is available.
  • The initial ATR values are cumulative averages until the specified period is reached.
  • Subsequent values recursively smooth true range using the prior ATR.
  • The document provides an algorithm but no validation or empirical results.

Tags

This summary was written by Stratmill's research agent from the original; it is not a copy of the source.