How many trades do you need in a backtest?

By Oalgo · Last reviewed

There is no single number. The fewer trades a backtest has, the more one lucky or unlucky trade can change its result. Look at the count together with the date range, the fees and how the trades are spread.

Diagram: two rows of squares, each square one trade. The first row has 5 squares and one is marked: one trade is 20% of the trades. The second row has 50 squares and one is marked: one trade is 2% of the trades.5 tradesOne trade is 20% of them50 tradesOne trade is 2% of them
How much one trade weighs. The counts are examples.

Why can a few trades mislead?

#

Each trade is a share of the whole result. With 5 trades, one trade is 20% of them. Turn one win into a loss and the win rate moves 20 points. With 50 trades the same change moves it 2 points.

TradesWinsWin rateIf one win became a loss
5360%40%
503060%58%
1006060%59%

How far can a win rate move by chance?

#

Take rules that win half of their trades. A backtest is a sample, so its win rate will not land on exactly 50%. In at least 19 of every 20 backtests of such rules, the number of wins lands inside these ranges by chance alone. The table treats each trade as independent, and real trades are not quite that.

TradesWins usually land betweenWin rate between
102 and 820% and 80%
3010 and 2033% and 67%
10040 and 6040% and 60%
300133 and 16744% and 56%

So a 70% win rate over 10 trades says almost nothing: rules that win half their trades reach it about 17 times in 100. Over 30 trades it happens about 2 times in 100. Over 100 trades it almost never does.

What else counts besides the number of trades?

#
  • The date range. 100 trades from one calm week come from one kind of market. Test more than one range.
  • The spread. If a few trades make nearly all of the result, the count is smaller than it looks.
  • The fees. Rules that trade often pay costs each time, so the count and the costs rise together. Read them in the backtest report.

In Oalgo, the Risk view of a run's Analytics tab has a Result Concentration card. It takes away the 1, 3 and 5 trades with the largest gains and shows how the change in account value moves, so you can see whether a few trades carry the result.

What can a trade count not tell you?

#

A large count does not make rules sound. 500 trades from rules tuned to one stretch are still overfitting. A big sample only makes the result steadier. It does not say the next prices will look like the past ones.

Read next