In this video we want to find out how to use the Strategy Tester.

This is a strategy test or also called a back test, we use it to use historical data and trade an Expert Advisor to find out if it’s profitable or not, so let’s find out how to do that.

Last time we have created a simple template with an output for this text: “Hello MQL5” and now we want to do a strategy test or back test with this simple example, to do that we click on; “View/ Strategy Tester” or press CTRL and R.

Now you should see this “Strategy Tester” panel here, we can pick a file, in our case we will start with the simple Expert Advisor (SimpleExpertAdvisor) that we have created last time.

We are going to use the currency pair: Australian Dollar against the Canadian Dollar (AUDCAD) for 1 minute and we want to pick a custom period in our case the year 2017.

This is one of the advantages in Metatrader 5, you don’t need to download historical data anymore, this will happen automatically as soon as you pick a period where you don’t have any historical data. It’s all done in the background, this setting is for the quality; it’s OHLC for open, high, low and close.

Whenever you point your mouse over a candle you will see an open, high, low and close price for that candle and that’s what this is. Every tick for a candle that contains several price changes is simulated and this is something that a lot of people don’t know.

If this big candle here would be 24 hours/ day candle every price change within these 24 hours except for the open, the high, the low end the close price would be calculated on a random basis even if you pick “Every tick” here.

If you would like to learn more about how it works just open the “Help” file and read the documentation. 

I never use forwarding because I don’t believe that anybody can predict the future, this execution setting could simulate a slow Network, I don’t use that either.

This is the balance on your testing account, you can set that to any value you want for US Dollar, Euro or whatever currency you prefer. 

This is the leverage; the higher the leverage the more money you can trade with a small account.

Optimization is something that we will discuss in a later video, for now just click on “Start” and now you should see the text: “Hello MQL5” on your chart, this is not very spectacular, so let’s change that and use the function: “TimeLocal”, recompile the code and when we restart the test we will now see an output for the local time that is calculated every time the price changes and in this video you have learned how to use the Strategy Tester and how to use the function: “TimeLocal” to output the local time for the Strategy Tester directly on your chart and you have coded it yourself with a few lines of MQL5 code.


SimpleExpertAdvisor.mq5 – Downloaded 54 times – 97.00 B