Discussing the article: "Price Action Analysis Toolkit Development (Part 74): Building an MQL5 Expert Advisor from Indicator Buffers"

 

Check out the new article: Price Action Analysis Toolkit Development (Part 74): Building an MQL5 Expert Advisor from Indicator Buffers.

This article implements an MQL5 Expert Advisor that connects to a weekend gap indicator via iCustom and CopyBuffer, reading six buffers for buy/sell signals and SL/TP. It validates broker stop-distance rules, handles closed-bar confirmation and duplicate-signal control, and executes orders with a configurable magic number. The EA also includes midpoint stop-loss management and a backtesting procedure so you can verify behavior and adapt parameters to your setup.

In order for an indicator to connect to an Expert Advisor, it must expose buffers that the EA can read through CopyBuffer(). In MQL5, buffers are the indicator’s output arrays that store values such as signal arrows, stop-loss levels, and take-profit levels for each bar. They act as the data channel between the indicator and the EA.

Indicator buffers provide a communication channel between the indicator and the Expert Advisor. The indicator writes calculated values into the buffers, and the Expert Advisor reads those values when needed. The buffers do not perform any actions themselves.

The custom indicator developed in the previous article exposes six buffers that contain all information required by the Expert Advisor. These buffers act as the communication layer between the indicator and the EA, allowing trading decisions to be made without recalculating the weekend gap logic.

Author: Christian Benjamin