Expert Advisors • Indicators • Scripts • Libraries

MQL.RobotFX.org is the biggest collection of MetaTrader expert advisors (MT5 & MT4), indicators, scripts and libraries that can be used to improve trading results, minimize risks or simply automate trading tasks

MetaTrader 5 Expert Advisor | AlliHeik

Idea by: josef strauss.

MQL5 code by: Vladimir Karputov.

The EA uses indicator Heiken Ashi Smoothed Oscillator:

MetaTrader Experts, Indicators, Scripts and Libraries

Exemplary signals "Open Buy" and "Open Sell":

MetaTrader Experts, Indicators, Scripts and Libraries

MetaTrader Experts, Indicators, Scripts and Libraries

Signals for opening positions is only received when a new bar appears, while trailing the positions is checked at each tick.

In this EA, the entire code relating to defining input parameters for Moving Average, to creating an indicator, and to receiving the indicator values is provided with comments - I decided not to completely remove this code: Perhaps, somebody would find a solution for applying it.

Instead, the following parameters were added: Trailing, signal reverse, and closing the opposite position when a signal appears.

Trailing

Position trailing. When the Trailing Stop is set to zero, trailing will be disabled.

Reverse

Flag Reverse signal completely turns the value of the signal for opening a position.

Closing the opposite position when a signal appears

Flag Close the opposite position on a signal at the value of true:

  1. It allows opening SEVERAL positions;
  2. When the "Open Buy" signal is received, it will close Sell positions; when the "Open Sell" signal is received, it will close Buy positions.

At the value of false, the EA will have ONLY ONE position in the market and, therefore, will not close the opposite position.

Recommendations on Optimization

Exemplary parameters, such as initial value, step, and final value, for symbols on H1:

MetaTrader Experts, Indicators, Scripts and Libraries

20680

Best MetaTrader Indicators + Profitable Expert Advisors