Skip to content
All library documents

Calculating OsMA with a Ring Buffer in MQL5

Article SuperMind

Summary

The document describes an MQL5 class for calculating the Moving Average of Oscillator (OsMA) with a ring buffer. It outlines initialization options for fast, slow, and signal smoothing periods and methods, buffer capacity, and indexing direction. Calculation can process an entire input array or a single value, and accessor methods expose the indicator settings and required history length.

Examples show drawing the resulting values in an indicator buffer and applying a second OsMA calculation to the first indicator's output. The ring buffer uses time-series indexing, which matters when mapping its values to chart bars. The material is implementation documentation rather than a trading method: it offers no signal rules, market evaluation, or performance evidence. The described buffer capacity limits stored observations, so users must account for that when processing longer histories.

Key ideas

  • The class calculates OsMA using values stored in a ring buffer.
  • Initialization configures the fast, slow, and signal periods and smoothing methods, along with buffer size and indexing.
  • The calculation interface supports both full arrays and individual input values.
  • Ring-buffer indexing follows time-series order, and examples demonstrate chart output and chained OsMA calculations.

Tags

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