Just like me, many of you are using the MetaTrader platform for daily trading using Experts Advisors. However, not many people know how to backtest in MT4 properly. In this short blog I will try to explain you the logic behind the EA optimization process on a MetaTrader 4 or 5 platform. If you do not know how to run the strategy tester on your MT4 platform then there are many places to go like YouTube to learn from. This article explains only the optimizing steps needed to get the best results during the optimization.
So here we go:
- How to approach mt4 strategy tester optimization
- Is 99% tick data accuracy one big lie?
- What level of tick data accuracy is needed for backtesting?
- Putting it all together
I will explain it on a simple example. Imagine we have a given trading system with the following trading results.
Now imagine today is the point where we have drawn a red vertical line. Of course we can not predict the future and the only thing that we can see are the backtested results from the past. So how can we make sure the optimized EA results are not curve-fitted and the optimized EA parameters have any chances of being profitable in the future? Let’s split our optimization process in two steps.
Optimize a given trading strategy on a small historical data fragment, from a given date in the past (Start) until today (End). It is extremely important that the number of trades in the selected period is representative for the given trading system. You need to optimize using at least 10% of the total number of trades which have occurred within history data range.
Test if the optimized parameters found in STEP 1 are not curve-fitted! Yes, this is my big secret magic trick, that I use in my all trading systems, so read and think about the following sentence for a while, let it sink in:
Basically, if I see nice results on a backtest using history data which was never used during the optimization (so called out-of-sample period), then it gives me confidence, that selected set of parameters could also be profitable in the feature.
In my early days when I was just starting my adventure in automated trading, everybody was saying (and still is) “You need to use 99% tick data to backtest properly, 90% is garbage etc..etc…”. I was like: ohh man..I need always to have 99% modelling quality! I was obsessed by tick data accuracy. I spent hundreds of dollars on tools which gave me 99% accurate tick data….but then I’ve discovered the following:
The 99% accuracy visible after a backtest is just a number in the FXT file header!
And moreover what does it mean to have 99% of accuracy? The answer is: it doesn’t mean anything! It is just representation of tick modeling quality for the broker where the tick data comes from and in almost all cases it is Ducascopy tick data. Furthermore in most cases people will use different broker with different tick prices, spread, latency etc…So 99% backtest data modeling is a myth, but 99% data is not entirely useless, read the flowing point.
There is one good answer: in best-case scenario you want to use the real broker live account data ticks. However this is only possible if:
- You are using MT5 platform and run your optimization using: “Every tick based on real ticks” mode. (Even then, most brokers provide slightly “adjusted” tick data, so no, they will not let you win that easy, hehe)
- Your broker will provide you the real recorded tickdata from a live account. (It does not happen a lot)
- You know how to record live tick data by your self and know how to export it to strategy tester. (Too difficult for most people)
If you can not use one of above mentioned options, then a simple alternative, is to simply test your history tick data for accuracy. The key word is: results correlation.
In order to test your historical data for accuracy just run the following simple test:
- Run your (or any other) EA on a live account on a selected broker. To minimize the potential losses minimize the lotsizes of open positions.
- Collect the live trading results for at least few days (or even weeks) in order to capture different market moods and events.
- After that, backtest the same EA using exactly the same EA settings and using the same time period! (In this step you can use 99% modeling or the tick data you currently have)
- See how big are the differences in trading results between live and backtested data.
- If the difference in all critical parameters such as: number of trades (very important), drawdown and profit etc..are not that big, then your history tick data is sufficient to be used in optimization and backtesting. If the differences are significant, then you need to test it on a different broker or using different source of tick data.
Trading strategy optimization and accurate result prediction is not an easy task, however it can really be achieved with a little bit of effort and practice. In order to achieve some level of confidence in your backtest, you need to make sure:
- Your EA settings are not curve fitted
- Trading results are also profitable outside your optimization period (in the past or the future)
- There is a good correlation between results from backtesting and optimization and the your live account
*** Bonus tip: The most important characteristic I’m using during selection of the best EA settings is the trading curve-shape! Ideally I want to see a straight line in upwards direction with as many trades as possible. If resulting trading curve has many dips (DrawDowns), then it means the strategy is risky since theoretically you could start your live trading precisely on a top before an upcoming DrawDown period and so blow up your account before making any profit. See a simple comparison between two different results below:
P.S.: do not forget to like or share this article!