Three-Layer Strategy Validation and the Blind Spot That Bit Me

本文为原文前 6,000 字符的节选翻译,完整内容请查看原文。

Three-Layer Strategy Validation and the Blind Spot That Bit Me

My validation stack had three layers, and all three were green. DSR came out at 1.000. Coin-block Monte Carlo showed a 0% ruin rate across hundreds of randomized pool combinations. Split-half stability was positive in both halves of the trade sequence. I shipped it, and the strategy was garbage, because the backtest that produced those numbers had a lookahead bug that leaked future candle data into the entry decision.

我的验证堆栈有三层,且三层全部显示为绿色。DSR(去偏夏普比率)为 1.000。硬币块蒙特卡洛模拟在数百种随机池组合中显示破产率为 0%。拆分半段稳定性在交易序列的前后两半均为正值。我发布了该策略,结果它却是一堆垃圾,因为产生这些数字的回测存在“前瞻偏差”漏洞,导致未来的 K 线数据泄露到了入场决策中。

The uncomfortable lesson: all three layers evaluate the statistical properties of one trade sequence. They assume that sequence was generated honestly. None of them audits how trades were generated. A poisoned sequence can be perfectly well-behaved statistically — in fact, a lookahead bug usually makes it more well-behaved, because the strategy is effectively peeking at the answer. High DSR, zero ruin, clean split-half — that’s exactly what a leak looks like.

一个令人不安的教训是:所有这三层验证评估的都是同一个交易序列的统计属性。它们假设该序列是诚实生成的。它们中没有任何一个会审计交易是如何产生的。一个被“污染”的序列在统计学上可以表现得非常完美——事实上,前瞻偏差漏洞通常会让它表现得更好,因为该策略实际上是在偷看答案。高 DSR、零破产率、完美的拆分半段稳定性——这正是数据泄露的样子。

This post is the four-layer design I run now, with the code signatures and a table of what each layer actually catches. The fourth layer is the one that would have saved me.

这篇文章介绍了我现在运行的四层设计,包括代码签名以及每一层实际捕捉内容的表格。第四层正是当初能拯救我的那一层。

Layer 1: Deflated Sharpe Ratio

The DSR (Bailey & López de Prado) adjusts an observed Sharpe ratio for the number of trials you ran, and for the non-normality of returns. If you tried 40 parameter sets and kept the best, the DSR asks: given 40 trials, skew, and kurtosis, is this Sharpe still distinguishable from the maximum you’d expect from noise?

第一层:去偏夏普比率 (DSR)

DSR(Bailey & López de Prado 提出)根据你运行的试验次数以及收益的非正态性,对观察到的夏普比率进行调整。如果你尝试了 40 组参数并保留了最好的一组,DSR 会问:考虑到 40 次试验、偏度和峰度,这个夏普比率是否仍能与你从噪声中预期的最大值区分开来?

(Code omitted for brevity)

(代码从略)

Two things matter operationally. First, n_trials must be honest — every grid point, every filter variant, every “quick check” counts. Second, the DSR is only as good as the return series you feed it. It has no opinion on whether that series is real.

在操作层面,有两点很重要。首先,n_trials(试验次数)必须诚实——每一个网格点、每一个过滤器变体、每一个“快速检查”都算在内。其次,DSR 的有效性取决于你输入给它的收益序列。它无法判断该序列是否真实。

Layer 2: Coin-Block Monte Carlo

I don’t bootstrap individual trades. Trades cluster — volatility regimes, correlated entries, streaks. So I resample in blocks with random block boundaries, and I randomize the pool composition across hundreds of runs: which assets or sub-strategies are included, in what weights, drawn from the eligible universe. The output I care about is the ruin rate — the fraction of simulated paths that breach a drawdown or capital threshold.

第二层:硬币块蒙特卡洛模拟

我不对单笔交易进行自助抽样(bootstrap)。交易是聚集在一起的——存在波动率机制、相关入场和连胜/连败。因此,我使用具有随机边界的块进行重采样,并在数百次运行中随机化池的组成:哪些资产或子策略被包含在内,权重是多少,这些都从合格的资产池中抽取。我关心的输出是破产率——即突破回撤或资本阈值的模拟路径比例。

(Code omitted for brevity)

(代码从略)

This layer answers: given this sequence’s dependence structure, how fragile is the equity path? It does not answer whether the sequence could have been produced by the strategy in the first place. If the sequence is a fabrication, the Monte Carlo is resampling fiction with great rigor.

这一层回答的问题是:考虑到该序列的依赖结构,权益曲线有多脆弱?它无法回答该序列最初是否确实由该策略产生。如果序列是伪造的,那么蒙特卡洛模拟只是在以极高的严谨性对虚构数据进行重采样。

Layer 3: Split-Half Stability

The simplest and most brutal check: split the trade sequence in two, require positive expectation in both halves. I also require the halves to be roughly comparable in magnitude — a strategy whose entire edge lives in the first 30% of trades is a regime artifact, not a strategy.

第三层:拆分半段稳定性

这是最简单也最残酷的检查:将交易序列一分为二,要求两半部分的期望值均为正。我还要求两半部分的量级大致相当——如果一个策略的全部优势仅存在于前 30% 的交易中,那它只是某种特定市场机制的产物,而非一个真正的策略。

(Code omitted for brevity)

(代码从略)

Split-half catches overfitting to a specific time window, edge decay, and single-r

拆分半段稳定性检查可以捕捉到对特定时间窗口的过度拟合、优势衰减以及单……(原文截断)