Test a backtest

Does your strategy beat random entries?

Maintained by Patrik Kelemen, founder of BenchAlgo. Last reviewed .

Short answer

Build many random twins of the strategy: the same number of trades per session, the same stops and targets and the same costs, but random entry times and random sides. If the strategy’s net result sits inside their range, chance explains it.

Why a rising curve proves little

Stops, targets and market drift shape a result before any entry logic matters. In a market that drifted up for years, almost any long-only rule looks good. A random twin keeps all of that and removes only the part you claim is skill: when and which way you enter.

How to build a random twin

  1. Keep the trade count. Use the same number of trades per session as the strategy, so activity is the same.
  2. Keep the exits and the costs. Use the same stops, targets, fees and slippage.
  3. Randomise the entries. Draw random entry times and random sides.
  4. Repeat with a fixed seed. Draw hundreds of twins, so the range is stable and the test can be reproduced.

How to read the result

Compare the strategy’s net after costs with the net of every twin. The p-value is the share of twins that did at least as well, counting the strategy itself:

p=1+#{k:Xk≥x}1+K

p = (1 + #{k : X_k >= x}) / (1 + K), where x is the idea’s net, X_k the net of random twin k and K the number of twins.

x is the idea’s net after costs, Xk the net of twin k and K the number of twins.

With 400 twins, if 12 of them do at least as well as the idea, p = (1 + 12) / (1 + 400), about 0.03. The one added above and below keeps p from ever reaching zero.

Test the two parts apart as well: random times with your sides, and your times with random sides. An idea can have good timing and no directional skill, and that is useful to know.

What it cannot tell you

Passing is not proof. Test twenty ideas and one will pass at p = 0.05 by luck alone, which is why the number of trials matters. White’s Reality Check, linked below, was built for this problem of reusing the same data many times.

How BenchAlgo handles it

The harness draws many random twins for every run and turns the comparison into a p-value. It also replaces your entry times with random ones and, separately, your direction with a coin flip. These are among the checks that can reject an idea on their own.

Sources

Test your own idea

Create a free account, describe an idea and read its twelve screens.