Skip to content
All library documents

Calculating and Building a Heikin Ashi Indicator in MQL5

Article MQL5 articles

Summary

The document explains how Heikin Ashi candles smooth traditional OHLC data to make trends easier to inspect. The close is the average of the current bar’s open, high, low, and close; the open is derived from the prior Heikin Ashi open and close. High and low use the corresponding raw price extreme together with the smoothed open and close. This recursive calculation can produce longer runs of same-direction candle colors and reduce the visual prominence of small countertrend moves.

The tutorial outlines an MQL5 custom indicator that stores the calculated values in buffers and draws colored candles, with separate bullish, bearish, and neutral colors. It highlights initialization of the first bar, which lacks prior smoothed values, and modular organization of indicator logic. The author reports attaching the finished indicator to a gold hourly chart and seeing the expected display. That is a visual implementation check, not evidence that Heikin Ashi improves trading returns. Because its values are smoothed and recursively derived, the display differs from raw traded prices and should not be mistaken for executable price levels.

Key ideas

  • Heikin Ashi close averages the current bar’s four raw price values.
  • Heikin Ashi open is calculated from the preceding smoothed candle’s open and close.
  • The high and low combine market extremes with smoothed candle values.
  • An MQL5 indicator can use four price buffers and a color buffer to plot the candles.
  • Smoothed Heikin Ashi values aid trend visualization but do not represent raw executable prices.

Tags

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