MetaTrader 5 has built-in Strategy Tester that allows you to test the performance of automated robots in trading. This is quite a handy tool in that it empowers one to test the efficiency of an Expert Advisor (EA) and detects the optimal strategies and parameters to use. 

EAs are used by many traders to come up with entirely automated trading strategies. But, EAs can also be used to test new ideas. Whichever way you lean, for partial or full automation, this guide will show you how you can start with MT5 Strategy Tester. 

What’s the distinction between .EX5 and .MQ5 files?

First up, let us take a look at the two different file types that you are bound to encounter in MT5. The .mq5 file is the one that human programmers can read. However, it is not a very efficient file, which is why it is converted into the .ex5 file that the computer can use. These two files are also commonly associated with the following names:

  • .mq5: source code file
  • .ex5: program or executable file

Any .mq5 that is added to MT5 gets automatically changed to .ex5 file. When traders purchase EA on the internet, they will find that it usually comes in .ex5 file. The reason for this is that .ex5 files protect their programming and don’t let others see how they work. 

But, if you work with a programmer or create an EA by yourself, it will be in the .mq5 format. If you are going to work with a programmer, ensure that they provide you with the .mq5 file because this way you will be able to make changes to it in the future. 

Installing Expert Advisor in MT5

Now, let us look at how you can start using Strategy Tester in MT5. Go through the following steps for the same:

  • Open MT5
  • Go to File and Open Data Folder (or hit Ctrl+Shift+D on the keyboard)

Installing Expert Advisor in MT5

  • Go to MQL5 and then ‘Experts’

Now, you can drag the MT5 EA into the folder. This can be in either format, .ex5 or .mt5. 

Installing Expert Advisor in MT5

Now, you are required to restart MT5. With that, you are now ready to begin testing your Expert Advisor in MT5 Strategy Tester. 

Using Strategy Tester

Before we move on to using Strategy Tester, let us first learn how to set up the test. As soon as MT5 restarts, navigate to ‘View’ and then select ‘Strategy Tester.’ Alternatively, you can press the hotkey ‘Ctrl+R’ to open it up. The following window should open up. 

Using Strategy Tester

On the screen, you should see a number of settings listed. Below, we go through them in the order that they appear:

  • Expert – Choose the EA you like from the dropdown menu.
  • Symbol – Choose the symbol for the backtest. 
  • Timeframe – Choose the timeframe you are going to backtest. 
  • Dollar sign – Click on this to receive details about the selected symbol. 
  • Date – Choose the preset date ranges
  • First Date – Those who have selected a custom period can select the starting date with this option.
  • Second Date – Those who have selected a custom period can select the ending date with this option.
  • Forward – This option lets you forward test the trading strategy. With this, MT5 will split the data into two parts and optimize only the first part. Thereafter, it will test the optimized settings in the second part. There is a high probability that the settings are reliable if you get similar results on the two sets of data. You will see extra tabs that show the results of the forward testing when forward testing is activated.
    • No – Forward testing is not being utilized. 
    • ½ – Forward test takes half of the time period.
    • 1/3 – Forward test takes one-third of the time period. 
    • ¼ – Forward test takes one-fourth of the time period. 
    • Custom – To specify the beginning date of the forward test
  • Delays – This option lets you choose from different time delays to simulate the delays experienced between the time when MT5 receives a signal and when the trade is executed. 
  • Select delay – This option lets you include some other factors that may influence profitability such as slippage, margins, and commissions. 
  • Modeling – To check how ticks are generated. 
  • Deposit – This option lets you adjust the deposit currency and your initial deposit. 
  • Optimization – This option lets you choose the algorithm that you wish to use. You can let MT5 run through a series of values in different settings to find the setting that works the best. 

Starting your First Test

Now that the setup is complete, click on the Start button to begin. If the ‘visual mode’ box is checked, the Strategy Tester Visualization will come up and show the backtesting trades. You can also speed up or slow down the test using the slider. It will let you watch your trades and check if the EA worked as expected. 

Starting your First Test

If the ‘visual mode’ box is not checked, you won’t see the trade chart. But if you want to see the progress of the backtest, switch to the ‘Graph’ tab at the bottom. It is the best way of checking the progress of the backtest as it also gives you a live update of your account balance and equity. 

Starting your First Test

Reviewing Results

Now that the test is completed, you can review your results. Just switch to the ‘Backtest’ tab to get the stats of the test. 

Reviewing Results

If you’re looking to learn MQL5 programming, it is best to start with an easy project and learn via trial-and-error. Start by programming a basic EA that lets you set up stop-loss and take-profit on trades. You can even find free code on the internet, learn how it works, and try to make some minor changes. It may take some time to learn how to code properly, but it is one endeavor that really pays off well. This way, you can test different trading ideas without having to pay someone to do so. 

Conclusion

We hope that through this guide, you now have a sufficient understanding of how to backtest your Expert Advisor in Meta Trader 5. Here is a word of caution for the reader: Always double-check the Expert Advisor that you install. There can even be some programming bugs that can lead to problematic results. Furthermore, just because you have tested an EA with Strategy Tester doesn’t mean that you will get the same results in live trading. 

That is why you should make sure that you always test your Expert Advisor for some time in a demo account after backtesting. Only then should you put it into live trading. All this testing can seem like a lot of work, but the results are well worth the wait. This way you will get an EA that will enable you to make profits even when you are away from the computer.

Leave a Reply

7  +  1  =