Trading Plan Backtesting Basics
Applying written rules to old data, mechanically, including every instance you would rather not count.
Backtesting applies a trading plan's written entry, exit and sizing rules to historical price data, in order, recording every trade the rules produce rather than the memorable ones. It gives you a win rate, an average win and loss, and an expectancy figure. To be worth anything it needs precise rules, realistic spread and slippage charged on every trade, and a sample large enough to span trending, ranging and volatile conditions.
What to remember
- Charging 1.5 pips of spread and slippage removed 30% of a 600 pip three-year result, and it removes three quarters of the edge on a 55% win rate at 1:1.
- On 30 trades the 95% band around a 38% win rate runs from about 21% to 55%, so a small sample cannot tell a working rule from a losing one.
- Nine ambiguous bars out of 120 moved the measured expectancy from 5.0 pips to 9.5 purely through how the stop-or-target-first question was resolved.
- Testing 40 parameter combinations on one period selects the luckiest variant, which is why a held-back twelve months is worth more than a better optimiser.
- A favourable backtest is evidence about past price behaviour, not a forecast of future performance.
Lesson 9 of 14 in Building a trading plan
Backtesting is your own rules replayed on old data, in order
Backtesting means taking the entry, exit and sizing rules you have written down, applying them to historical price data bar by bar in the order the bars arrived, and recording every trade the rules produce. Not the good ones. Every one. The output is a list of trades with dates, entry prices, exit prices and outcomes, and from that list you get a win rate, an average win, an average loss and an expectancy figure. That is the whole exercise. It gathers evidence without risking capital, and it tells you nothing you did not put into the rules.
It fails before it starts if the rules are too vague to apply mechanically. "Buy the pullback in an uptrend" cannot be backtested, because two people reading it will mark up different trades, and so will you on two different days. "Buy at the close of the first candle that closes back above the 20 EMA, after price has held above the 200 EMA for at least ten bars" can be. Tightening a loose plan until it is testable is most of the value here, and it happens before you look at a single result.
One hundred and twenty EUR/USD trades, before and after costs
Here is a small breakout rule run across three years of EUR/USD four-hour data. It produced 120 trades. The right-hand column charges every trade 1.5 pips, being a 1.2 pip spread plus 0.3 pips of average slippage.
| Measure | Gross | After 1.5 pips of cost |
|---|---|---|
| Trades | 120 | 120 |
| Winners | 46 (38.3%) | 46 (38.3%) |
| Average win | 42.0 pips | 40.5 pips |
| Average loss | 18.0 pips | 19.5 pips |
| Expectancy per trade | +5.0 pips | +3.5 pips |
| Three-year total | +600 pips | +420 pips |
Costs removed 30% of the result, and 1.5 pips is a mild assumption on EUR/USD in London hours and an optimistic one on anything thinner or anything traded across the daily rollover. A backtest run gross is not an optimistic version of the same strategy, it is a different strategy that nobody can trade. Convert the pip figures into money for your own lot size with the pip calculator before deciding whether 3.5 pips a trade is worth the screen time.
Notice also what carries this record. A 38.3% win rate is fine because the average win is 2.3 times the average loss. Apply the same 1.5 pips of cost to a 55% win rate at 1:1 on a 20 pip target and the gross edge of 2.0 pips a trade falls to 0.5, which is inside the noise. The cost line matters most to the strategies that trade most often.
How many trades before the win rate means anything
A win rate measured on a small sample is a wide range pretending to be a number. At a true rate near 38%, the 95% band on 30 trades runs from about 21% to 55%. Two hundred trades narrows it to roughly 31% to 45%. Five hundred gets you to about 34% to 43%.
Read that first band again. On 30 trades you cannot distinguish a strategy that loses steadily from one that works, which is why a backtest of a handful of favourable examples is not weak evidence but no evidence. It also means the sample has to span varied conditions, not one clean trending stretch. Three years of EUR/USD contains trending months, ranging months, a rate-cycle turn and at least one volatility shock, and a rule that only earns its expectancy in one of those has an exposure problem the plan needs to name.
10 more sections in MarketPro
Finish this lesson in MarketPro
The rest of Trading Plan Backtesting Basics, a quiz that checks it landed, and your place kept in the curriculum.
- 10 more sections of this lesson
- All 320 lessons, with no cap and no paywall
- Free on any account, including a free one
Same account as the app · No install · Free to start
Or scan with your phone camera to get the MarketPro app.
Free account, no card needed.
Not investment advice. Past performance is not indicative of future results.
Run the numbers while this is fresh
Work it through on your own position size. Nothing leaves your browser and there is no sign-up: Position size calculator, Risk of ruin calculator, Compounding calculator.
Trading Plan Backtesting Basics: questions
How many trades does a backtest need to be meaningful?
What is overfitting in backtesting?
Should I include spreads and slippage in a backtest?
The whole academy is free in MarketPro
All 320 lessons, 12 guided paths, quizzes and a daily streak. Free on every account, in the app or your browser, with vetted free signals alongside it.
Same account as the app · No install · Free to start
Not investment advice. Past performance is not indicative of future results.