Skip to content
All library documents

Calculating Adaptive Moving Average with a Ring Buffer

Article MQL5 code base

Summary

This document describes a software class for calculating the Adaptive Moving Average (AMA) with a ring buffer in MQL5. It outlines initialization settings for the AMA period, fast and slow EMA periods, buffer capacity, and input indexing, then describes methods for processing a full array or individual values. It also explains how to read calculated values from the buffer and use them in a custom indicator.

The examples demonstrate calculating AMA from a price series and applying AMA again to an existing indicator series. The class relies on separate ring-buffer and Efficiency Ratio components, which must be installed alongside it. The document provides no performance tests or trading results, and it does not explain the indicator’s formula or establish that AMA signals are profitable. Its contribution is implementation guidance for indicator calculation and data access, rather than a trading strategy.

Key ideas

  • The class calculates Adaptive Moving Average values using a ring buffer.
  • Initialization sets the AMA period, fast and slow EMA periods, buffer size, and indexing convention.
  • Input can be processed as a complete array or as individual sequential values.
  • Calculated values can be accessed by index and copied into an indicator buffer.
  • The implementation depends on companion ring-buffer and Efficiency Ratio classes.

Tags

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