What the sample size calculator answers
A backtest with 40 trades and a 60% win rate looks like an edge. It may also be a coin that landed heads 24 times out of 40, which happens more often than most people expect. The question is not how good the results look, but how sure they let you be.
This calculator takes the number of trades and how they turned out, and gives the range in which the true expectancy probably sits, whether that range is clear of zero, and how many trades an edge of this size needs before it is. If you tried several versions before keeping this one, it raises the bar accordingly.
How to use it
- Enter the number of trades in the backtest (or in your live record).
- Describe the results, either as a win rate with the average win and average loss in R, or as the average trade and its standard deviation in R. R is the amount you risk per trade.
- Pick a confidence level. 95% is the usual choice.
- Enter how many strategies, settings or variants you tried before this one. Enter 1 if it is the only one.
The formulas
expectancy E = win rate × average win − loss rate × average loss
spread of trades sd = (average win + average loss) × √(win rate × loss rate)
range of E E ± z × sd ÷ √trades
trades needed (z × sd ÷ E)²
z for 95% 1.96, or Φ⁻¹(1 − α' ÷ 2) with α' = 1 − 0.95^(1 ÷ tries) (Šidák)
win rate range Wilson score interval
The spread formula is exact for trades that either win the average win or lose the average loss. With your own list of trade results, use the second mode and enter their average and standard deviation (AVERAGE() and STDEV() in a spreadsheet).
Worked example
A strategy won 45% of 100 trades, with an average win of 1.8R and an average loss of 1R:
- Expectancy: 0.45 × 1.8 − 0.55 × 1 = +0.26R per trade, a profit factor of 1.47.
- Spread of the results: 2.8 × √(0.45 × 0.55) = 1.39R.
- 95% range of the true expectancy: −0.01R to +0.53R. It touches zero, so 100 trades don't yet separate this edge from luck.
- Trades needed at this edge and spread: (1.96 × 1.39 ÷ 0.26)² = 111.
- The win rate itself is only known to within 35.6% to 54.8%; pinning it to ±5 points takes 381 trades.
Now say this was the best of 20 settings an optimizer tried. The Šidák correction raises z from 1.96 to 3.02, and the trades needed rise to 262.
Rules of thumb, and why they differ
You'll read "30 trades", "100 trades" and "200 trades". None is right in general, because the answer depends on the size of the edge compared with the spread of the results. Halve the edge and you need four times as many trades. A strategy with a small average gain and large swings may need thousands; a steady one with a big edge, far fewer.
| Win rate | Avg win | Avg loss | Expectancy | Trades needed (95%) |
|---|---|---|---|---|
| 45% | 1.8R | 1R | +0.26R | 111 |
| 40% | 2R | 1R | +0.20R | 208 |
| 55% | 1R | 1R | +0.10R | 381 |
What it can't fix
- Overfitting. The correction for several tries assumes they were independent. A grid of similar settings is partly the same test, and the calculator can't see choices you made by looking at the chart.
- Regime changes. Trades from one kind of market say little about another. Spread the test across years and conditions; walk-forward analysis is the standard way.
- Dependence. Trades that overlap in time, or that cluster in streaks, carry less information than the same number of independent trades.
- Costs. An edge that only exists before fees is not an edge. Check it with the trading fee calculator.
For the related question of how good a profit factor has to be, read what is a good profit factor. To test a Sharpe ratio after many tries, use the deflated Sharpe ratio calculator.