Author of the idea — pcbiz, author of the MQL5 code — barabashkakvn.
Today, I want to dive into the Escape Expert Advisor (EA) designed for MetaTrader 5, which leverages two moving averages — iMA(5) and iMA(4) — on the M5 timeframe. This EA is crafted to make your trading decisions smoother by setting individual TakeProfit and StopLoss levels for both Buy and Sell orders.
Decision-Making Process
Here’s a quick look at how the EA operates:
{
double diClose_M5_1=iClose(1,Symbol(),PERIOD_M5);
double diMA5=iMAGet(handle_iMA_5,1);
double diMA4=iMAGet(handle_iMA_4,1);
if((diClose_M5_1<diMA5))
{
OpenBuy();
return;
}
if((diClose_M5_1>diMA4))
{
OpenSell();
return;
}
}
The conditions are checked only when a new bar appears. This not only streamlines the process but also significantly reduces CPU load, allowing for quicker testing in the "Every tick" or "Every tick based on real ticks" modes.
Test Results
Here’s a glimpse of the performance metrics from the backtest on the EUR/USD M5 pair, running from June 1, 2016, to November 23, 2016, starting with a deposit of $1,000:

Comments 0