Back to Trading Styles & Strategy Development

Trading Styles & Strategy Development · Pro · 4 min

The MetaTrader 5 strategy tester

You can choose a suitable tick-generation mode in the MetaTrader 5 strategy tester, run an optimization with a forward period and read the main report figures.

Years in minutes

A manual backtest of 100 trades takes several evenings. MetaTrader 5's built-in tester runs an Expert Advisor through years of history in minutes, and can try thousands of settings overnight.

That speed is its strength and its danger. Used carefully, it tests ideas in hours that would otherwise take months. Used carelessly, it produces impressive reports about strategies that only ever worked in the past.

Realistic vs. fast

The strategy tester runs an EA on historical data as if it were trading live, and reports the results. The most important setting is how prices are simulated.

Comparison Tick generation modes in the MetaTrader 5 strategy tester: every tick based on real ticks is the most realistic and the slowest; open prices only is the fastest and suits rules that act on closed bars, but misses movement within a bar. Most realistic Every tick based on real ticks Slowest Fastest Open prices only For bar-close rules Misses intrabar

According to the MetaTrader 5 help, the modes include:

If your EA uses tight stops or acts inside a bar, use real ticks. Also set realistic costs: the spread, commissions and, for positions held overnight, swap. A test with zero costs is not a test.

Keep a forward period

The tester can optimize: run the EA many times with different settings and rank the results. The MT5 help describes a fast genetic algorithm that searches large numbers of combinations in hours rather than years.

Optimization is exactly where overfitting happens. The tester's forward option helps:

Steps Using the forward option: optimize the settings on the first part of the period, test the chosen settings on the second, forward part, compare both results, then keep or discard the settings. 1 Optimize on part 1 2 Forward test part 2 3 Compare both 4 Keep or discard

The period is split, for example into halves. The tester optimizes on the first part and runs the chosen settings on the second, forward part. Settings that shine in part 1 and collapse in part 2 were fitted to noise.

When reading the report, look at the profit factor (gross profit divided by gross loss), the expected payoff (average result per trade), the maximum drawdown, and above all the number of trades behind these figures.

Common mistakes

The takeaway

The MT5 strategy tester backtests EAs on history. Choose realistic ticks and costs, keep a forward period and read the report with suspicion.

Check yourself

Quick quiz

4 questions. Instant feedback, nothing is saved.

  1. 1Tap the mode to use when exact intrabar prices matter, for example for tight stops.

    Tap the chart.

    Comparison Chart for the question: Tap the mode to use when exact intrabar prices matter, for example for tight stops. Most realistic Every tick based on real ticks Slowest Fastest Open prices only For bar-close rules Misses intrabar

    Every tick based on real ticks uses tick history collected by brokers, so stops and targets inside a bar are simulated more realistically.

  2. 2What does the forward option in the MT5 tester do?

    The forward part acts as out-of-sample data for the optimization.

  3. 3The genetic algorithm finds the best of 10,000 parameter sets. What is the main risk?

    The more sets tried, the more likely the winner is lucky.

  4. 4What does the profit factor in the test report show?

    MetaTrader's report defines it as the ratio of gross profit to gross loss.

of 4 correct.

Sources

Back to Trading Styles & Strategy Development