Skip to content
All library documents

Exact Simple Moving Average Calculation for Average True Range

Article MQL5 code base

Summary

This note describes an alternative implementation of Average True Range. It says the example provided with MetaTrader 5 approximates a simple moving average of true range to reduce execution time, producing results that are very close to an SMA but not mathematically identical. The proposed version calculates the SMA directly instead of using that approximation.

According to the description, the exact calculation retains execution speed that does not vary with the selected period and needs no extra buffer allocation. These are implementation claims only: the text gives no benchmark, code, formula details, or independent performance comparison. It also does not discuss how a different ATR calculation might affect trading signals or results, so any practical impact would depend on the application and should not be inferred from this note alone.

Key ideas

  • The described implementation calculates ATR using an exact SMA of true range.
  • The note contrasts this with a MetaTrader 5 example that approximates the SMA.
  • It claims execution speed is independent of the calculation period and requires no extra buffer allocation.
  • No benchmark or evidence is provided to quantify speed or trading impact.

Tags

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