Skip to content
All library documents

Building Heikin Ashi Indicators and an EA in MQL5

Article MQL5 articles

Summary

This beginner tutorial explains how to build a Heikin Ashi indicator in MQL5, calculate a moving average from its candle data, and use both indicators in an Expert Advisor. It outlines the Heikin Ashi formulas: average the period’s open, high, low, and close for the close; derive the open from the prior Heikin Ashi open and close; and set the high and low from the relevant extremes. The article also describes using a custom indicator’s data in an EA, then forming entries around Heikin Ashi and moving average crossovers.

For trade management, the EA uses Heikin Ashi levels to set stops and targets, limits daily trades, calculates position size dynamically, and can trail stops as candle patterns indicate a continuing trend. The evidence is instructional: code examples and explanations of implementation choices, rather than reported performance tests. Heikin Ashi smooths price movements, which can make trends easier to read but means its values do not represent actual traded prices. The author presents the strategy for education and advises testing before live use; the article provides no evidence that the system is profitable.

Key ideas

  • Heikin Ashi candles use averaged calculations to smooth the appearance of price movement.
  • A custom MQL5 indicator can store Heikin Ashi open, high, low, and close values in buffers.
  • An Expert Advisor can retrieve custom indicator data and combine it with a moving average for entry signals.
  • The example manages trades with Heikin Ashi based stops, targets, position sizing, trade limits, and trailing logic.
  • The tutorial offers implementation guidance, not measured evidence of trading performance.

Tags

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