The Expert Advisor trades based on two iMA: iMA(5) and iMA(4) on the M5 timeframe. Individual TakeProfit and StopLoss levels are set for Buy and Sell.
Block for making decisions:
The conditions are checked only when a new bar appears. This way the load on CPU is greatly reduced, and testing in the "Every tick" or "Every tick based on real ticks" testing modes is performed quite fast.
Test results on EURUSD M5, from 2016.06.01 to 2016.11.23, initial deposit - 1000:
Translated from Russian by MetaQuotes Software Corp.
Original code: https://www.mql5.com/ru/code/17009