Skip to content
All library documents

Calculating the Efficiency Ratio with a Ring Buffer

Article MQL5 code base

Summary

This document introduces a ring-buffer class for calculating the Efficiency Ratio (ER), an input used by the Adaptive Moving Average. It describes initialization options, including the ER period, buffer capacity, and indexing convention, and provides methods for processing a full array or an individual value. The class also exposes basic metadata such as the required bar count, period, and buffer size. Its example shows how to calculate ER from a price series and read the resulting values into an indicator buffer, with ring-buffer indexing aligned to time-series order.

A second example applies the value-by-value method and then calculates another ER from the first indicator’s output. The material is primarily an implementation reference rather than a trading strategy or performance study. It explains the interface and intended use, but does not give benchmark results, discuss parameter selection, or evaluate how ER-based signals perform in different markets. Users need the accompanying ring-buffer support and example files in the indicated MQL5 include structure to reproduce the examples.

Key ideas

  • The class computes the Efficiency Ratio used in Adaptive Moving Average calculations.
  • ER can be calculated from a full input array or from successive individual values.
  • The ring buffer supports time-series indexing and can feed its output into another indicator calculation.
  • Initialization sets the calculation period, buffer capacity, and input indexing convention.
  • The document describes interface usage but provides no evidence about trading performance or optimal settings.

Tags

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