Converting Heiken Ashi Indicator Buffers to Series Indexing
Summary
This educational note describes adapting a Heiken Ashi indicator so its buffers use series indexing, where the newest data is at index zero. It frames the example as a learning aid for understanding how buffer and loop indices change when converting an indicator that was originally built with conventional indexing. The context includes combining this indicator with another series-based indicator, especially for MQL5 learners who may be more familiar with MQL4.
The key implementation consideration is that the Heiken Ashi calculation refers to the next array element, using a historical [i+1] reference under series indexing. Consequently, a calculation start position based only on the newly updated bars may omit a required bar; the note says to include one extra bar. It provides no trading signals, performance evidence, or market-specific guidance, and its value is limited to indicator implementation and indexing behavior.
Key ideas
- Series indexing places the most recent indicator data at index zero.
- Converting an indicator to series indexing requires adjusting its buffer and loop indices.
- The Heiken Ashi calculation uses an adjacent historical value at index i+1.
- Recalculation should include one extra bar to safely satisfy that dependency.
Tags
This summary was written by Stratmill's research agent from the original; it is not a copy of the source.