Our partnerSkilling
  • Spreads from 0.1 pips
  • 1,000+ instruments
  • Free demo account

65% of retail investor accounts lose money when trading CFDs with this provider.

Open account
Module 5 · Test the robot properly

5.1 Backtesting in the strategy tester

Lesson 14 of 19Reading time: 2 min

A backtest runs the robot on historical data, as if it had traded in the past. It is the fastest way to find out whether an idea is worth working on.

How to start a test

MetaTrader 5: Open the Strategy Tester (Ctrl+R). Choose the robot, market, time frame and period. Choose the model Every tick based on real ticks if the broker has such data. Press Start.

MetaTrader 4: Ctrl+R, choose the robot and market, model Every tick, and press Start.

cTrader: Choose the robot in the Algo app, open the Backtesting tab, choose a period and Tick data, and press play.

Important settings

  • Period: At least one to two years, preferably more. Include both quiet and volatile periods.
  • Spread and commission: Use realistic values. Many strategies that look profitable with zero spread lose money with a real spread.
  • Starting capital: The same amount you actually intend to use.

The figures to look at

FigureWhat it tells you
Net resultDid the robot make money – after costs?
Number of tradesFewer than 100 trades gives an uncertain picture
Win rate and average win/lossThe profile of the strategy
Profit factorGross profit ÷ gross loss. Above 1.3–1.5 is good after costs
Maximum drawdownThe largest fall from peak to trough. Could you live with it?
The equity curveSmooth and rising, or a few big wins?

The pitfalls

Ernest Chan describes several classic mistakes in Quantitative Trading:

  • Look-ahead bias: The robot uses information it could not have had – for example the close of the candle that is still open. That is why we use candle 1.
  • Bad data: Gaps and errors in the history give wrong results.
  • Too few trades: A few lucky trades can create a good result.

The backtest is the best case

A backtest has no slippage you have not added, no technical faults and no emotions. Live results are almost always worse than in the test. Count on it.

Try it yourself

Run the robot on two periods separately. Are the results similar? Note the number of trades, the win rate and the maximum drawdown.

Key takeaways

  • Test on at least one to two years with realistic spread and commission.
  • Look at the number of trades, profit factor, drawdown and the equity curve.
  • Live results are almost always worse than the backtest.
Practise what you have learned – without riskTry it on a free demo account with Skilling, with real prices and virtual money.
Open a free demo account

65% of retail investor accounts lose money when trading CFDs with this provider.