MQL5 TUTORIAL – COMMON BACKTESTING ERRORS

Today I wanted to talk about a few things that might go wrong in your back testing process.
From time to time you will find that the back test doesn’t create the results that you might have been expected, there are countless reasons for that, and in this video I wanted to go through a few very common reasons.
Here is a typical mail from a customer who wants to say that the Forex Trading Framework doesn’t work as shown in the video. In this case we would have made 425 Dollars; we have traded the Forex Trading Framework.
If you click on the “Inputs” tab here you will find a user adjustable variable for the trading risk, the default setting is 1 and I will now change that to 10, start another test and this time we should see very different results. It will take a few more seconds until our test is finished, we are now in June and now our test is finished and with just one setting we changed the result to 7,720 Dollars profit, so if you see the “Inputs” tab, make sure that you adjust the values.
Another common problem would be an account size that is too low. Let’s try 30 US Dollars. Now I start the test and it is finished immediately, we made a loss that was bigger than the account size.
Let’s change it to 300 Dollars. This time we lost 259 Dollars and we have grounded the account within 19 days.
Let’s try 3,000 US Dollars, it goes up first, this looks very promising and this time we turned a 3,000 Dollar account into a 7,720 Dollar profit but it was pure luck. This account size is far too small.
I prefer 100,000 US Dollar upwards. Most of the time I trade 300,000 Dollars now.
Something else that might influence your results is if you trade every tick open high low and close prices or open prices only.
Let’s start this test and we made 7,720 Dollars again but it depends on the strategy you use, you might get very different results if you trade open prices only. Usually I would suggest to trade open high low and close prices.
Let’s create a position size that can’t be traded to cause an error and this time the graph is flat and we see lots of errors here in our “Journal” tab saying that we have tried to trade an invalid volume. If you see those kinds of errors in your journal just Google for MQL5 error codes and you will find the site with quotes of errors and warnings on mql5.com. Just click on the “Return Codes” and you will find a long list of things that might go wrong depending if your broker supports everything you do.
A common error is: invalid stops.
For example if your trailing stop or your stop-loss is too close.
We have caused the invalid volume error here, so let’s go back to the correct version, recompile the code, start a new test and now it works again.
Okay, now you have seen a few very common errors that you might want to avoid for your own back testing and if you see something that doesn’t work out as expected please make sure to click on the “Journal” tab and look for the course.
Let’s set the visualization option here for the next test, it’s always a good idea to spend some time to watch your trading system because that’s when you really see if it works as you wanted it to work. You can also undock the lower part to see the graph here.
It’s always a good idea to spend some time to check out if your trading system works as designed and now you know how you can find the most common errors in your back testing.