Essays · The harness

Out-of-sample testing: the harness that kills most edges

The short version This is the thing that decides whether an idea gets a dollar or a headstone. Two tiers, pessimistic fills, netted fees, and — the part most retail backtests skip entirely — scoring each strategy on whole market regimes it was never allowed to see.

This isn't about a strategy. It's about the harness we run every strategy through. Most ideas come out the other side with a headstone. That's not a bug; it's the entire point.

The default assumption: it's a mirage

We start every test from the same place: this edge is noise until proven otherwise. Base rates demand it. Search enough parameters across enough assets and some combination will look profitable by pure chance. So the backtest's job isn't to confirm the idea — it's to give the idea every honest chance to fail. Survive that, and you have something. Fail, and you saved the tuition.

Tier one: the Lab

The first tier is a fast simulation whose only job is to kill the large majority of ideas cheaply. It's approximate on purpose — enough fidelity to reject the obvious mirages, fast enough to run hundreds of parameter samples. Most ideas die here, and that's fine; they were never going to make it to the expensive test.

Tier two: the Courtroom

The rare survivors go to a full, fee-realistic, 1-minute, gap-aware replay. No dollar figure is trusted until it clears this tier. The honesty mechanics here are non-negotiable:

The part that does the killing: Leave-One-Regime-Out

Here is the piece most retail backtests skip. We keep a fixed library of distinct market regimes, chosen before the run: a blow-off top, bear markets, a bull, a range, a recovery. Then we hold out each regime once, fit the strategy on the rest, and score it on the regime it never saw. Rotate through all of them. A strategy passes only if it's profitable on a strong majority of the held-out regimes.

Why this matters: most "edges" are regime-conditional. They aren't a market truth — they're a description of one kind of market. Fit and test in the same regime and you'll never notice. This is where out-of-sample testing earns its keep, and it's a stricter cousin of walk-forward analysis: rather than only stepping forward in time, we deliberately withhold structurally different markets and demand the edge generalise to them.

The regimes are fixed in advance for a reason. If you pick the test window after seeing the result, you're not testing — you're cherry-picking a win and calling it science.

Why not just k-fold cross-validation?

Standard k-fold cross-validation shuffles rows at random, which for time-series data quietly mixes the future into the training set — look-ahead bias by construction. Any honest financial validation must respect the arrow of time: train on earlier data, test on later, and never let a fold peek forward. Leave-One-Regime-Out keeps that temporal integrity while adding the thing plain walk-forward can miss — an explicit demand that the edge work in market characters it was never shown.

The failure modes it exposes, over and over

The takeaway

We publish the graveyard on purpose. The refutations earn the trust; the rare survivors are the product. An edge that clears next-bar fills, one position at a time, a real t-stat, netted fees, and profitability across held-out regimes it never saw — that's rare, and it's the only kind worth funding.

Next time someone shows you a curve, ask one question: which regimes did it never see, and did it still work? If they can't answer, you already have your answer.

Keep reading