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.

SkillingOpen account
Module 3 · Build and test strategies with AI

3.3 Backtesting – done right

Lesson 12 of 26Reading time: 2 minFact-checked

Backtesting means testing a strategy on historical prices. It is useful – but it is easy to fool yourself.

Split the data before you test – and look at the answer key only onceTraining (2015–2021)Find and tune rules hereValidation (2022–23)Choose between variantsTest (2024–26)Used once, at the endTimeIf you test on the same data you built the strategy on, the result will almost always look too good.Walk-forward: move the window forward in time and repeat – it's closer to reality.
Split the data into training, validation and test – and use the test data only once.

Five rules for an honest backtest

  1. Include all costs: spread, commission, overnight financing and slippage.
  2. Split the data. Build the strategy on one period, and test it on a period you have not seen.
  3. Test in different markets: rising, falling and sideways periods.
  4. Look at enough trades. Fewer than 100 trades tells you little.
  5. Look at the whole picture: the largest drawdown, the longest losing streak and how even the result is – not just the total profit.

Key figures to look at

Key figureWhat it tells you
ExpectancyWhat you make on average per trade, in money or R
Profit factorGross profits divided by gross losses. Above 1.3 is often a minimum after costs
Maximum drawdownHow far the account fell from a peak – can you live with it?
Number of tradesMore trades give more reliable figures

The backtest is always too optimistic

In real life you also get mistakes, technical problems, worse execution and your own emotions. Expect the result to be worse than in the test.

From the books: fresh data can only be used once

David Aronson’s book on evidence-based technical analysis has a rule worth remembering: out-of-sample data is only “out of sample” the first time. If you test, adjust the strategy and test again on the same data, that data has become part of the development.

Decide in advance what result would make you drop the idea. Then look once.

Key takeaways

  • Include all costs, and test on data you did not use to build the strategy.
  • Look at expectancy, profit factor, maximum drawdown and the number of trades.
  • Real 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.