Matana Labs

Combinatorial purged cross-validation: the “Combinatorial windows with a gap” check

Combinatorial purged cross-validation (CPCV) cuts the period into slices, holds out every pair of slices in turn, fits the strategy on the rest and tests it on the held-out pair. A gap of days is removed around each held-out slice so information can’t leak across the seams. Matana Labs runs every fit and every test on the engine.

What it checks

Time is serial: ordinary cross-validation peeks across the seams. Here the seams are closed off by a gap, and the test slices are any pair, not necessarily consecutive.

The question behind it: Is it overfitted to history? In the app it is in Analysis Lab → Checks, stage “After optimization”. Were the numbers overfitted by brute force? Needed after parameter optimization in the “Improvement” step.

How it works

The period is cut into 5 slices. Each pair of slices, in turn, is validation (10 combinations), the rest is optimization over a grid of −20, 0, +20% for the marked numbers (or the first two from the blocks, if none are marked); a 5-day gap is dropped around the validation slices. Optimization and validation are continuous engine runs over day lists.

How it gets its status

These are the app’s own rules, shown on the check’s card:

With fewer than 30 trades or 20 days in the run, the check still shows its numbers, but its status is at most “with a caveat” and the result is marked as unreliable.

How to read the result

The Combinatorial windows with a gap check in Matana Labs: a table of held-out slice pairs with the values chosen on the rest and the test result
“Combinatorial windows with a gap” on a test data set: one row per pair of held-out slices.

In the score out of 100

When it has a status, it counts toward the overall score with weight 1: “holds” earns full points, “with a caveat” half and “broke down” none; “can’t compute” is left out.

Every plan, the free one included, can run it; any engine runs it needs are counted in backtest-years.

If it breaks down

What's optimized on some slices doesn't work on others — the parameters are overfit.

This is the app’s own suggestion; under Improvement the app tests candidate changes on the engine before it shows them.

Screenshots show the real app on a test data set. Backtests and simulations are not real trading, and past results don’t guarantee future ones. Not investment advice.

Keep reading

See Matana Labs plans, from free

Questions

Why not ordinary cross-validation?

Market time is serial: nearby days are related, so a test slice next to a fitting slice can peek through the seam. The gap removes those days.

Which numbers are fitted?

The numbers you marked for optimization, or else the first two numbers in the strategy’s blocks, on a small grid around their current values.

How is it different from walk-forward?

Walk-forward only tests forward in time. CPCV tests on every pair of slices, so it gets many more test results from the same history.