How Our Backtest Judge Caught Itself Out, and What We Fixed
A strategy judge is only worth something if its verdicts can be checked, including against itself. On 11 October 2026, while re-reading our own reports, we found a false sentence in the Lab's judge: the SPA test said a strategy "beats buy-and-hold significantly" when it was doing worse than buy-and-hold. Here is the defect, its cause, the fix, and the measurements that verify it.
This is research on past public data. Nothing here is investment advice.
What happened
That same day, the Lab was judging five classic trend-following strategies walk-forward over 2019-2025 (full results: five famous trend-following strategies judged across several crypto cycles). Four of them ended clearly below buy-and-hold: their mean per-bar difference was negative, with a t statistic between -2.16 and -2.58.
Yet each of these four reports displayed:
SPA p = 0.02: the setting frozen on training beats buy-and-hold significantly.
The displayed p-values ranged from 0.5% to 2% (2%, 1.1%, 0.5% and 0.82%). A strategy below the benchmark cannot beat it "significantly". The sentence was wrong.
The SPA test, in two sentences
The SPA test (Superior Predictive Ability, Hansen 2005) answers one question: does the best of the strategies tested really beat the benchmark, or is it the kind of gap chance produces when several rules are tried? It compares the observed statistic with thousands of resamples of the data (bootstrap); the p-value is the share of resamples that do at least as well as the observed one.
The cause
Hansen's test truncates the observed statistic at zero: T = max(0, t). If the strategy is below the benchmark, t is negative and T equals 0. The resampled statistics T* are truncated too, so always greater than or equal to 0. By definition, the share of T* greater than or equal to 0 is 1: the p-value must be 100%.
Our estimator counted T* strictly greater than T instead of greater than or equal. With T = 0, it only counted the rare draws where the strategy moved ahead of the benchmark, hence a tiny p-value and a "significant" sentence. A > where a ≥ belonged.
The defect affected every single-candidate SPA test in the Lab: single split, proof pooled across markets, fixed rule, portfolio and walk-forward. It also affected the multi-variant training SPA when all variants are below the benchmark.
What was fixed
- The estimator now counts T* ≥ T, as in Hansen's definition. A statistic truncated at zero gives p = 100%. When the observed statistic is positive, counting "≥" or ">" is the same: the test's ability to detect a real strategy does not change.
- Defensive reading of old reports: wherever a verdict or a sentence reads this p-value, the Lab checks the observed statistic. If it is zero or negative, the p-value read is 100%, even in a report written by an earlier version. An old report can no longer display "significant" below the benchmark.
- Old receipts remain verifiable: each receipt is re-verified with the estimator it declares. Fixing does not erase history.
- Risk against buy-and-hold is now reported fold by fold in walk-forward (maximum drawdown, Calmar, Ulcer, share of rallies and declines captured, time in position).
The fix was made in version 245 of the Lab and is carried into 246 (see below). The download page still serves 243: if you use it, a "significant" SPA sentence on a strategy that does worse than buy-and-hold should be ignored.
Measurements, before and after
A fix gets measured. We replayed the same computations, bit for bit, before and after.
| Check | Before | After |
|---|---|---|
| Synthetic series "strategy below buy-and-hold" (t from -11.8 to -54.2) | p = 0% | p = 100% |
| The 4 walk-forward reports of 11 October (same chain, same t) | p = 2%; 1.1%; 0.5%; 0.82% | p = 100% for all four, sentence "compatible with chance" |
| Pure noise, 3 scenarios × 100 runs: SPA ≤ 10% while the strategy is below the benchmark (single split) | 3; 9; 82 | 0; 0; 0 |
| Same, walk-forward | 8; 100; 88 | 0; 0; 0 |
| Pure noise: "survives" verdict | 0 everywhere | 0 everywhere (unchanged) |
| Power: strategies with a real injected edge, "survives" verdict (single split / walk-forward) | 6 / 8 and 54 / 81 out of 100 | identical: 6 / 8 and 54 / 81 |
Reading: on pure noise, the old computation displayed a "significant" SPA below the benchmark up to 82 and 88 times out of 100 in one scenario. After the fix: zero. And the Lab still detects strategies with a real edge just as often.
Why no false verdict came out
The Lab's final verdict never rests on a single test. To say "survives", it also needs an out-of-sample chain above buy-and-hold, a majority of folds won, a sufficient DSR and at least 30 independent events. Those conditions were already blocking: the four strategies stayed "inconclusive", before and after.
The path to a false "survives" did exist, though. A defensive strategy can end above buy-and-hold in compounded return, because it avoids the big drawdowns, while having a negative arithmetic mean difference per bar. In that case, the faulty SPA could have supplied the missing piece. That path is closed.
In the first version of this article, one point was still open: a second, fixed-block SPA test had the same form. It moved to the corrected estimator in 246. Proofs sealed before remain verifiable, byte for byte, with the estimator they declare.
Next: getting audited by another AI
Finding a defect yourself is useful. Being reviewed by someone with no reason to go easy on you is the real test. After 245, we handed the Lab's source code, and its use over MCP, to another AI: Codex. Its brief: look for anything that would let a strategy get "survives" without earning it, each finding with a file, a line and a worked scenario. Every finding was then checked against the code and, when possible, reproduced.
The most telling one hit the deflated Sharpe ratio, the statistic that penalises a result according to the number of attempts. With an effective number of attempts barely above 1 (two nearly identical variants, for instance), the approximation of the benchmark turned negative: the penalty became a bonus. The deflated Sharpe rose to 99.99% instead of 54%, on one of the gates of the "survives" verdict. The other gates held, but that gate itself was wrong. In 246, the benchmark never goes below zero and grows with the number of attempts: the same case now gives 53.2%.
Version 246 brings 21 fixes from this audit. A few examples:
- The Pine export of a proof changed period. A proof judged on 2,000 bars was exported on 17,971, without its fees. The export now keeps the window, fees, execution policy and the fingerprints of the script and data, and the Pine only trades from the start of the test period.
- An ATR stop could never exist. A lot bought before the ATR could be computed had no stop: three lots held down to -35.6% despite
stop_loss: 2 * ATR(14). No buy happens any more until its stop can be computed. - "Stop first" was displayed, not applied. When a candle touches both the stop and the target, the cautious option appeared in the lots engine's receipt, yet 262 lots still exited at the target. It is now applied, on CPU and GPU.
- Monte Carlo forgot open positions, which skewed the probability of loss published in reports (with no effect on the verdict).
- The SPA threshold is now a budget. Shared across every rule judged, it is spent so that the sum stays below 10%. And when the bootstrap is too coarse to decide at that threshold, the Lab answers "insufficient resolution" instead of deciding.
These safeguards were measured again on the merged version: 0 false "survives" on 872 pure-noise proofs, and 0 in 350 automatic research sessions. They also have a cost, measured and published: in one of the planted-signal scenarios, the Lab confirms the signal 2 times out of 100 instead of 11. We prefer a judge that lets fewer real strategies through to one that invents them.
Version 246 is built and under verification; it will be published on the download page once its last checks pass. To plug your own AI into this judge, here is the Lab's MCP guide.
What it changes if you backtest on TradingView
TradingView's Strategy Tester runs a strategy on the displayed history. It gives a profit, a drawdown and a win rate, but no held-out test period and no significance test. When you read a "significance" statistic anywhere, including from us, four reflexes:
- Check the sign before the p-value. A p-value does not say which way the gap goes. If the strategy does worse than buy-and-hold, no p-value makes it better.
- Compounded and average returns say different things. A rule that avoids crashes can end higher in capital while losing on average bar by bar. Look at both.
- Ask for the never-seen period. A result computed on the whole history, after tuning, mostly measures how well it fits the past.
- Require a judge to be tested on noise. A serious judge publishes how often it calls a strategy with no edge "significant", and how often it detects a real one. That table is what lets you trust it, or not.
To have your own Pine script judged on a period it has never seen, the Lab is free and computes the verdict on your PC. The free online judge gives a first verdict in your browser, without installing anything.
Key takeaways
- The Lab's judge wrongly displayed a "significant" SPA (p of 0.5% to 2%) for strategies below buy-and-hold: a
>where a≥belonged. - Fixed at the cause: p = 100% when the observed statistic is zero, including when old reports are re-read.
- Measured: false "significant" results on noise went from 82 and 88 out of 100 to 0, power unchanged, no verdict modified.
- Then an external code audit by another AI (Codex): 21 fixes in 246, including a deflated Sharpe that rose to 99.99% instead of 54% with very few attempts.
- An incorruptible judge is not a judge that is never wrong: it is a judge that gets audited, and whose mistakes are visible, measured and fixed in public.
Further reading: backtest engine and Monte Carlo and our methodology.
Research on past public and simulated data. Nothing on this page is investment advice.
⚠️ Disclaimer — This article is for informational and educational purposes only. It does not constitute investment advice or a buy/sell recommendation. Past performance does not guarantee future results. Strategy Arena is an educational simulator with virtual capital. Always do your own research before making investment decisions.