Skip to content
All library documents

Calculating DEMA with a Ring Buffer in MQL5

Article MQL5 code base

Summary

This document explains an MQL5 class for calculating the Double Exponential Moving Average (DEMA) with a ring buffer. It outlines initialization settings such as the smoothing period, moving-average method, buffer size, and series orientation, then describes methods for processing a full input array or individual values. Accessor methods expose the calculated DEMA and the moving average computed alongside it.

The examples show how to integrate the class into an indicator calculation routine, copy values into output buffers, and use the individual-value method to calculate a second DEMA from the first. The document states that ring-buffer indices follow time-series indexing and that the required supporting classes must be available in the expected MQL5 include directory. It demonstrates implementation mechanics rather than a trading signal, and provides no tests, performance comparisons, or evidence that DEMA improves trading outcomes.

Key ideas

  • The class computes DEMA using a ring buffer and supports array-based or incremental value processing.
  • Initialization configures the period, smoothing method, buffer capacity, and data orientation.
  • The calculation also produces a moving average that can be read through a separate accessor.
  • Ring-buffer indexing is described as matching time-series indexing.
  • The examples cover indicator integration, not trading performance or signal validation.

Tags

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