How to backtest & optimize in MT4
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
1. How to approach mt4 strategy tester optimization?

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.
STEP 1:
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.
STEP 2:
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.
2. The 99% tick data accuracy is one big lie!
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.
3. What level of tick data accuracy is needed for backtesting?
- 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)
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.
- 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

Greets,
Chris
P.S.: do not forget to like or share this article!
Tried several times to use an EA, but always met with bad eeather. May be my poor knowledge or it was just a phenomenon. Any way lost confidence.
I think you got something there that might help the dump money traders .Keep up the Good Work. Daniel .Cheers
Your graphs in section “Bonus tip” resemble what I use to test. First phase I look at Graphs for downdraw locate DD events and then go roughly 1 month before when input time period to test to test for worst case scenarios … this can require several hours to test when going back years and looking for DD events and Second phase is once I identify dates of DD events I utilize Strategy Tester to change inputs to handle difficult event and then examine results for reasonableness to determine if I want to use EA or abandon it if it doesn’t provide good return on my investment. If I do find useable results then “hopefully” they’ll provide a good hedge against future events and yet still provide a decent relatively safe profit. (never know about future events because they’re inherently “unforeseeable” like Chf event awhile back … many traders/brokerages went under because of those a**holes not announcing what they were going to do … and I’m sure a select few benefited). I do this with a few currency pairs EA was supposedly designed for and evaluate.
I try to pick a time period where balance might not cover DD to change inputs or change balance to test feasibility study on EA and sensitivity to various inputs and balances.
I use TDS and am aware of the header … they showed me how to change the text in an older version and it was interesting … can make it 100% if I want to … I did change to 99.99% to show a friend. Even if you change TSD options such as “slippage” and try to account for latency and use Ducascopy data there can be significant differences between “virtual” simulation and reality but I still consider it a useful tool and closer to reality to test visually the way the EA works and gain better insight into the logic of the EA to decide if it has good potential or not using my years of experience (good and bad) as a guide.
Thanks for sharing your feedback, yes I am also familiar with the work of our mutual friend Birt 😉 But some time ago I’ve switched to TickStory and then to tick data recording and now almost only MT5 which comes as close as it get to simulating with “real ticks”.
Hi Chris, please share your Tick Data Recording tool (or code). It will be very much appreciated. Thanks.
Hi Yudi,
Ok contact me on my email…
gr
chris
Hi,
How can I baccktest CoensioRecoveryEaV03F?. I tried but it does not backtestest.
Regards.
Hi,
please read the manual.
Gr
Chris