ArticlesBlog

MQL5 TUTORIAL BASICS – 3 HOW TO USE THE STRATEGY TESTER

MQL5 TUTORIAL BASICS – 3 HOW TO USE THE STRATEGY TESTER


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 + 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 that we have created last time. We are going to use the currency
pair Australian dollar against the Canadian dollar for one minute and we
want to pick a custom period. In our case the year 2017. This is one of the
advantages in Metatrader5. 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 OLHC 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 a 24 hours daily candle,
every price change within these 24 hours except for the open, the high,
, the low and 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. no audio

Comment here