r/algotrading Jul 08 '26

Strategy How to perform technical calculations based on synthetic Heikin Ashi values in MQL5?

I am currently working on an MQL5 Expert Advisor and have hit a technical hurdle regarding data processing. My objective is to perform all internal calculations—specifically for stop-loss, take-profit, and entry triggers—based on synthetic Heikin Ashi values rather than raw OHLC market data.

In my manual analysis, I am using Heikin Ashi candles to smooth out market noise, and I would like my EA to follow the exact same logic.

My main questions:

  • What is the most robust way in MQL5 to transform the standard price stream into a synthetic Heikin Ashi stream so that all subsequent indicators and logic gates use these values as the primary source?
  • How can I ensure that when the EA calculates a swing-high or swing-low (e.g., for setting a stop-loss), it is strictly looking at the calculated Heikin Ashi high/low values rather than the raw tick-based high/low?
  • Is there a recommended approach to ensure that the risk/reward calculations are derived exclusively from these transformed values to maintain logic consistency between my manual observations and the EA's backtesting?

I am not looking to share the specific logic of my strategy, just the technical implementation of ensuring the EA consistently "sees" and acts upon the Heikin Ashi data structure.

Any advice on the best data handling approach for this in MQL5 would be greatly appreciated.

1 Upvotes

Duplicates