Calculating Average True Range with a Ring Buffer
Summary
This document describes a software class for calculating Average True Range (ATR) with a ring buffer. It accepts high, low, and close price data, and supports both whole-array calculations and calculations for individual values. The smoothing period and moving-average method can be configured, with a simple moving average as the default.
The examples show how to calculate ATR from price series and how to feed the resulting buffer into another ATR calculation. The buffer uses time-series indexing and provides access to its values, period, size, and other settings. The document explains the interface and integration pattern, but does not provide performance benchmarks or compare its output with other ATR implementations. The buffer’s finite capacity also means its size is a configuration choice for the application using it.
Key ideas
- The class calculates ATR from high, low, and close price inputs.
- It supports array-based calculations and calculations for individual data points.
- The smoothing period and moving-average method can be selected during initialization.
- The ring buffer uses time-series indexing and can supply values to further indicator calculations.
Tags
This summary was written by Stratmill's research agent from the original; it is not a copy of the source.