TermRisk managementAdvanced

Backtesting

Backtesting is testing a trading strategy on historical data to see how it would have performed under fixed rules. It gives you statistics, not a guarantee about the future.

How it works

You write entry, exit, stop and position-size rules precisely enough that they can be applied without guesswork. Then you run them over past data, either by hand while scrolling a chart or with software. The output is the number of trades, the win rate, average win and loss, and maximum drawdown.

The main trap is overfitting: you tweak parameters until the strategy explains the past perfectly and means nothing for the future. That is why the history is split in two: you build the rules on one part and test on a part the strategy has never seen. You also need to include fees, spread and slippage.

Backtesting is usually followed by forward testing: trading the strategy in real time on a demo account or with small size. If results are much worse than in the backtest, there was probably a mistake or overfitting somewhere.

Example with numbers 1

A strategy tested on 3 years of BTC data produced 120 trades: 45% winners, average win 2R, average loss 1R. Expectancy is 0.45 × 2 − 0.55 × 1 = 0.35R per trade. If fees and slippage cost 0.1R, you are left with 0.25R: lower, but still positive.

Example with numbers 2

The same strategy with tuned parameters won 70% of trades in 2021–2022, but only 38% in 2023, which was not used for tuning. That is a sign of overfitting.

Common mistake

A common mistake is testing a strategy on 15–20 trades and treating the result as proof. With such a small sample, luck easily looks like an edge. Aim for at least a hundred trades across different markets and conditions (trending and ranging), include costs, and always check the rules on data you did not use to build them.

Questions and answers

What is backtesting in simple terms?

It is checking a strategy against past data to see what would have happened if you had traded your rules before. It helps you drop bad ideas before risking money.

How many trades do I need for a backtest?

The more the better. A common guideline is at least 100 trades across different market conditions, otherwise the result may be luck.

Why did my strategy work in the backtest but not live?

Typical reasons are overfitting to history, ignoring fees and slippage, data that accidentally peeks into the future, and the market changing.

Read next

Updated: 2026-10-19