How to BackTest EAs in MT4 – step-by-step Guide

7 min read

Backtesting EA (Expert Advisors) in MetaTrader 4 (MT4) refers to putting the trading robot to test in historical data. During backtesting, the MT4 platform picks EA and checks its performance on historical data. MT4 backester is an advanced plugin that allows full customization and settings tweaking, making it a robust tool in any developer’s toolkit. Backtesting is the backbone of successful online financial trading and paves the way for profitable performance. Backtesting EAs before actually putting them in live markets is key not to losing money. Let’s delve deeper into this intriguing world and explain how to backtest and tweak your trading robots in MT4. 

Setting Up MT4 for Backtesting

MetaTrader 4 (MT4) backtester plugin is called Strategy Tester. You need to launch it before you can test any EAs on the MT4. There are two ways to make strategy tester visible, one is to click on the icon in the top menu or to use the CTRL + R key shortcut. Naturally, you need to have the MT4 platform installed on your computer before you can do all the following procedures of testing EA. 

Installing an EA for Backtesting

To start backtesting the EA, you need first to download and install it in the MT4. After the EA has been placed in dedicated folders of MT4 and launched on the platform, you will be able to select and use your EA in testing. 

Let’s discuss the strategy tester and its functionality to make backtesting easier. 

Strategy Tester detailed explanation

As you can see, the strategy tester has some advanced functionality, which is its main advantage. However, it is also a little complex plugin and requires a detailed explanation to use it properly. The 1st thing to do after EA has been installed is to select it from the list of EAs(1). After the EA has been selected, you can select the asset to test your EA on(2). The next step is to select the model(3) for testing. Depending on the EA, it may be better to use every tick for more accurate results, or control points only if the EA checks signals on the opening of every candle. 

To test EA on your preferred date and period, you will need to enable date(4). After checking the Use Date cell, you can select the period (5) you want to backtest your EA on. By allowing Visual Mode(6) you will be able to see how EA is trading on a chart, which is slower than no visualization, but very convenient to see if EA does what you want it to do. The scroll (7) enables you to control how fast the backtesting has to be conducted and is useful to see how EA behaves in a simulated historical market environment. 

Now, you need to select the timeframe(8) the EA was designed for. Some EAs are specifically developed for certain timeframes and require testing on the exact timeframe. So, selecting the timeframe can be crucial for proper results. In the spread (9) menu you can select the typical spreads for the broker and asset or use the current spread. In this case, the EA will use spreads that are currently available in MT4. 

Expert properties (10) is another important tool. Here, you can adjust and tweak all the settings that the EA uses for trading. You can also save your preferred settings or load the already saved settings file. This is a helpful feature of the MT4 strategy tester, and it allows you to save the best settings and use them later for actual live trading. Ensure to follow the developer-recommended settings for the first testing phase. Ensure your EA uses proper stop loss and takes the profit.

After all the mentioned steps have been completed, click on the start button (11). The tester will launch the EA on simulated historical data and follow your instructions and testing speed. 

If you set the speed to the highest, the EA will quickly run through the historical data and show results on the charts. 

After the backtest has been completed, it is important to check the results and analytics. This is possible by the bottom menu of the strategy tester. 

Results (1) will show the performance of the EA in the given period. It is the list of each trading position the EA has taken with profits or losses. To check results using a visual graph, just click on the graph tab (2). The graph is a better way to see if the EA performed well. The profitable EA needs to have a healthy curve, where earnings are increasing over time. You do not want to see an abnormal graph that shows the EA was not consistent. 

The most significant tab is the Report(3) tab. The report’s tab gives all the statistical performance data and ratios which can be analyzed to conclude how well the EA behaved and how its settings can be tweaked for better performance. One of the most important metrics of EA is maximum drawdown, which shows how much EA was losing along the way. You do not want to see large numbers here. In our case, the maximum drawdown was 1.83% which is a healthy number. 

Common Backtesting Pitfalls to Avoid 

The most common pitfall that can happen to inexperienced traders is to test EA on insufficient historical data. Using limited historical data can lead to skewed results. Correct this by ensuring you have a sufficient dataset that accurately represents market conditions. 

Another common mistake is to over-optimize the EA or to overfit its settings. This happens when the EA becomes overly adjusted to historical data. If you fit your EA to a specific period, there is a high chance of it failing on the live markets or showing significantly different results. You can correct this by focusing on robust strategies and testing EA on different date windows. 

EAs usually ignore market news and events. News can seriously screw the performance of EA and show different results. Incorporate this into your EA by limiting it, and prohibiting it from trading during certain news hours. This can be quite a complicated challenge to solve. One way is to turn off EA during news events. 

Last but not least mistake is to use improper risk management. Double-check that your EA incorporates appropriate stop loss and takes profit limits to control risks.

Leave a Reply

avatar

This site uses Akismet to reduce spam. Learn how your comment data is processed.

  Subscribe  
Notify of

🍿️ Discover your path to a 100% yearly returns over the convos with Chris Svorcik!

X