How Many Trades Do You Need to Backtest a Strategy?
How many trades a backtest needs before you can trust it, with the math behind the margin of error, a simple table, and what to do if a strategy trades rarely.
You need more trades than feels natural. A rough read takes about 100, and a decision you would put money behind takes 300 or more. The reason is simple: a small sample has a wide margin of error, so a good result can easily be luck.
The math in one table
If your real win rate is near 50%, the 95% margin of error on what you measured is about 1.96 times the square root of (0.5 × 0.5 ÷ trades).
| Trades | Margin of error | A measured 55% could really be |
|---|---|---|
| 30 | ± 18 points | 37% to 73% |
| 50 | ± 14 points | 41% to 69% |
| 100 | ± 10 points | 45% to 65% |
| 300 | ± 6 points | 49% to 61% |
| 1,000 | ± 3 points | 52% to 58% |
Look at the 100 trade row. A 55% win rate there still includes a real win rate below 50%. Whether that matters depends on your risk and reward, because the win rate you need depends on the size of your winners.
Why a good first result proves little
Flip a fair coin 30 times and about one run in ten shows 19 or more heads. Now imagine trying ten small changes to a rule and keeping the best one. Of course it looks good. The more versions you try, the more trades you need before you believe the winner.
What to do in practice
- Fix the rule first. Write it down before you count, so you can't bend it along the way.
- Set the number in advance. Decide on 100 or 300 trades, and don't stop early when the numbers look good.
- Cover different markets. Include trend days, chop, high volatility and quiet weeks.
- Keep some data back. Test the final rule on days you didn't use while building it.
- Count the costs. Commission and slippage can erase a small edge. The profit factor calculator takes them off every trade.
Getting to 300 trades
A manual sample of 300 sounds slow, but a replay moves much faster than the market. You skip the dead hours and step candle by candle through the part that matters. ChartTrainer's backtester can run a scripted rule across many sessions in one go, and replay practice with the date hidden lets you build a manual sample from random days. See manual vs automated backtesting for when to use each. Backtest results don't promise real results.
Questions
- Is 30 trades enough to backtest a strategy?
- It is enough to reject a rule that clearly doesn't work, not to trust one that looks good. At a 50% win rate, 30 trades leave a margin of about 18 points either way.
- How many trades do I need to backtest?
- About 100 for a rough read and 300 or more for a real decision. Rules with rare big winners need more, because a handful of trades decides the result.
- Does the number of years matter as well?
- Yes. 300 trades from one quiet month say little about a volatile one. Spread the sample over different conditions, such as trend and chop, high and low volatility.
- What if my strategy only trades once a week?
- Then a real sample takes years of data. Use a replay or backtest tool to cover them quickly, and test the same rule on similar markets to get more cases.
- What if my sample gets worse as it grows?
- That often means the early trades were luck. Trust the larger sample, and be wary of cutting the bad period out to make the numbers look better.