Today is Thu, October 19, 2017 21:50:15 GMT
RSS Follow Us Follow us on Twitter Friend us on Facebook
MT4 Trading & Education Tips on How to Backtest MT4 Expert Advisors and Forex Robots


Register for a free OANDA MT4 demo account here.

Our work at involves programming strategies and testing their performance. Over the years, we have backtested numerous MT4 EAs, or expert advisors. It does not take us long to screen through hundreds of trading robots to select which we deem to have the potential for improvement. We would like to share some of our experience with you.

share tips

Sufficient MT4 Data Points for Backtest

Your backtest is only as good as the data you have. Calculated as “modelling quality” in the MT4 strategy tester, make sure you have sufficient data points for your software to test on. On your Metatrader platform, click Tools > History Centre:

tools history centre

Then select the currency pair and timeframe, click download to ensure you have updated data. These data differ from broker to broker, so it can be a good idea to backtest the software on a few broker platforms, especially with the broker you are trading with.

history centre

Enable Expert Advisors on MT4

If you EA does not run, make sure they are enabled on your Metatrader. Click on Tools > Options > Expert Advisors and you will see this:

enable EA

Make sure the box is checked next to Enable Expert Advisors.

Visual Mode is Slower, but Useful

On strategy tester, you can check to select “Visual Mode”. Even though this slows down the backtest, you can see the trades in action on a moving historical chart, and observe the behavior of the EA. You see a scroll bar to the right of the check box, which allows you to speed up or slow down the visual backtest. Once you understand the behavior of your robot, you can unselect Visual mode to speed up the backtest.

Lack of Trades

Sometimes after a backtest, you only see a few trades executed. This could be due to a lack of data points, for example you may be running a weekly strategy. Or it could be a matter of the strategy being tested; some trading strategies trade only a few times a year due to very selective conditions. Depending on your trading personality, you may want a robot which trades more frequently.

Excessive Drawdown

A great feature about visual mode is you can click on “Graph” and see the account balance, as the robot tests the data. The graph below shows a robot with excessive drawdowns. This means you can make profits along the way, and even over the long term, but there will be times where your account balance is down by a large amount, which is risky. Large drawdowns can affect trading performance, especially if your position sizing for trades is linked to the account balance.


Excessive Risk

Sometimes in visual mode you can see illogical trading behaviour, such as holding a trade to breakeven point, no matter the duration. In the example below we see a sell trade, holding period indicated by the red horizontal line. The market went against the trade direction, and this robot holds on to a losing position until it recovers to breakeven point. This may not be realistic because the long period of negative equity may wipe out your account.

This trade actually went 280+ pips against the robot, before it recovered and retraced to breakeven point. The question here is, how long can you hold on to a losing position, what if it takes months to recover to breakeven, or even years?

long sell

Martingale Strategies

Martingale strategy means a trader increases his trade size after every loss, so that the next win would recover all previous losses plus win a profit equal to the original stake. If you notice the graph below, every time the account suffers a large drawdown, it quickly recovers. This is due to the Martingale strategy as you see circled in blue below, where trade size increases to cover up a loss.


Assuming you have infinite trading capital and account balance, Martingale strategies are great. It becomes a problem if you suffer a string of losses to the extent that your account balance does not allow you to “double down” on the next trade, to make up for previous losses.

This popular strategy is often the basis which programmers code a constantly upward sloping backtest. If you backtest a forex robot and the performance graph is literally an upward slope, with sharp recovery from drawdowns – in line with increases in position size, the strategy is likely to be Martingale. Just make sure it suits your risk profile and trading capital.

Lastly, Forward Test

An EA can work perfectly in backtest, perhaps due to indicators which are backward looking, but you definitely need to forward test the robot to test it’s logic. For example, if an indicator repaints, it may work well on backtest but fail on forward tests since the indicator is constantly changing. Forward testing also allows the robot to execute on live conditions  and spreads, which is more realistic than a backtest. And of course, with a forward test, your data is 100%, and modelling quality is also 100%.

share robot

Expert Advisors which We Like

In conclusion, we like robots which do not suffer large drawdowns, which display realistic trading behavior such as applying stop loss, which have a good probability of an upward sloping curve over the long term, and demonstrate these in forward tests as well. If you have any robots which you think are great, feel free to share them with us!

This article first appeared on