MQL5 Tutorial Step 6 – How to do your first automated backtest

In this video we are going to do the first automated test, if you click on the folder “Expert Advisors” you will see a few files and an “Examples” folder. Now, please click on the “Examples” folder and in the examples you will find an Expert Advisor that is called: “Moving Average”, now let’s click on: “View/ Strategy Tester” or press CTRL and R on your keyboard and now you should see the “Strategy Tester” panel here and here you want to select the: “Moving Average.ex5” file, pick a currency pair here, select the 1-minute chart – that’s the M1 chart –, now let’s change the data quality to 1 minute OHLC – that’s open, high, low and close prices – and click on start.
…and this is what you can expect from the built-in strategy tester example that is the Moving Average Expert Advisor that is delivered by Metaquotes right out of the box and it’s a sure way to get broke in a few months!
Now why should anybody include an Expert Advisor that will ruin your account?
Well, that is a good question but I cannot answer it. I think you will agree with me that there is a lot of room for improvement here.
Let’s go back to “Settings”, enable the visualization mode and start another test, and now you can watch the simple Moving Average Expert Advisor trade and if you invest enough time you might find out that your account balance will go down on a consistent basis.
I will speed that up for you and now you can watch your account go to hell… We are on January the 3rd and we have made a loss of about 150 Dollars.
Now you know how to start your first MQL5 backtest and trade the “Moving Average.ex5” file that is by default included in the “Examples” folder from Metatrader 5 and I will promise you it will produce a loss and in the next few videos we are going to change that.