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



  1. Introduction to the Power of Automated Trading (00:00 – 00:17) Discussing the significant advantage of automated trading: the ability to make thousands of trades within minutes.
  2. Using the Strategy Tester in Metatrader 5 (00:17 – 00:30) Instructions on accessing the strategy tester in Metatrader 5 and selecting the moving average expert advisor for testing.
  3. Setting Up a Test for Automated Trading (00:30 – 00:57) Steps to set up a test for automated trading, including choosing a custom period and setting initial account parameters.
  4. Starting the Automated Trading Test (00:57 – 01:19) Initiating the test and observing the Metatrader 5 as it buys and sells based on the automated strategy.
  5. Observing the Results of Automated Trading (01:19 – 01:40) Watching the impact of automated trading on the account balance and noting the rapid loss of funds.
  6. Testing Different Currency Pairs and Observing Outcomes (01:40 – 02:03) Trying out different currency pairs in the strategy tester and observing similar rapid losses.
  7. Understanding the Risks of Default Expert Advisors (02:03 – 02:31) Realizing the dangers of using default expert advisors without understanding their strategies and the predictable losses they can cause.
  8. Importance of Testing and Understanding Automated Systems (02:31 – 03:09) Emphasizing the importance of thoroughly testing and understanding automated trading systems before using them in live trading.
  9. Learning from Predictable Failures in Automated Trading (03:09 – 03:50) Encouraging viewers to learn from the predictable failures of automated systems and understanding that trading is often set up for most people to lose.


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.