Validation Lab: walk-forward & Monte Carlo

Two stress tests that separate a real edge from one lucky stretch.

A backtest that wins overall can still be carried by a single lucky period — or by the particular order its trades happened to land in. The Validation Lab, on every result page, runs two stress tests that attack exactly those two kinds of luck. The Reality check stays free for everyone; this deeper layer is Pro and up.

Walk-forward: does the edge hold across time?

Run validation compares a fixed strategy and its existing parameters across time slices. The result-page button requests 5 slices; shorter data reduce that to 3–4. The API accepts 3–10 requested slices, adapting down to keep at least 80 bars per slice; fewer than 240 bars cannot be evaluated. Slices are consecutive and non-overlapping, with any remaining bars in the last slice.

Each slice starts with a fresh account and no carried position. Indicators are calculated from that slice's candles, without an earlier preparation buffer. There is no training, parameter selection or re-optimization. The 80-bar minimum is an eligibility floor, not a guarantee that a long-lookback indicator is ready or enough trades remain. This is a period-consistency check, not automatic out-of-sample evidence.

  1. “Holds up across time” — at least ~70% of windows profitable, with reasonably consistent results. The edge held across periods.
  2. “Mixed across periods” — in between: profitable in some windows but not most (40–70%), or mostly profitable yet with results swinging so widely between windows that the average hides the instability.
  3. “Regime-dependent” — positive return is concentrated in a few periods. “Loses across all windows” is reserved for strictly negative account returns in every evaluated window, not zero returns.
  4. “No completed trades” — no window closed a trade. Positions may still be open, and entry commissions can make the account return negative even with zero completed trades.
  5. “Zero account return across all windows” — every account return is exactly zero and at least one window has completed trades. This is not an all-loss result.
  6. “Negative and zero-return windows” — for example, one negative and four zero-return windows. The card separately counts positive, negative and exactly zero returns, and windows without completed trades. A small-sample warning uses total completed trades divided by evaluated windows; it does not claim every window has too few trades.

Out-of-sample and the separate tail split

Out-of-sample means data kept out of strategy design, tuning and selection until evaluation. Restarting indicators or cutting a known history into slices cannot establish that separation. If you used a period to choose or change the strategy, re-running it does not make it unseen data.

The backtest API's optional oos_train_ratio is a separate initial-slice/tail split. It runs the same strategy without training; the field name does not mean a model was trained. Where supported, oos_metrics records the tail result. It needs at least 150 total bars and 50 per part; otherwise oos_metrics is null, and direct Python-worker replay does not compute it. A translated Python strategy can apply DSL-derived costs to the initial slice but request-level costs to the tail, so identical costs are not guaranteed. Validation Lab does not populate these metrics or update the original Reality check's OOS flags. A stored tail result still cannot prove that the tail was unused in design or selection.

Monte Carlo: re-drawing the saved trades

Run Monte Carlo creates 1,000 hypothetical paths by drawing N net equity returns with replacement from the run's N saved closed trades. Some trades can repeat and others be omitted; it is not a permutation of the same trades. Each path compounds those returns and stops at zero equity. For fixed-fraction returns, changing order alone preserves the compounded ending (apart from floating-point differences), although the drawdown path can change. Replacement sampling can change the ending too. Entry and exit commissions are included by the stored accounting ledger; open positions and their entry costs are excluded. Signals, sizing and costs are not re-run on new candles.

  1. Re-draw 5th–95th percentile range — the central empirical 90% of sampled ending returns, not a confidence interval for future returns. The median is a re-draw summary, not the original result. Histogram bar height is the count in each rounded return range; counts total 1,000. Rounded boundaries may overlap, and a constant outcome has one bucket. Expand the table to read ranges and counts without relying on color or hover.
  2. Re-draws ending above 0% — only strictly positive endings count. Zero is excluded, and the remainder can be negative or exactly zero. The API rounds this fraction to two decimals, so the displayed percentage is approximate; it is not a future profit probability. For example, 705 positive paths out of 1,000 appear as approximately 71%. Classification uses the unrounded share: at most 60% is fragile; at least 90% with a positive 5th percentile is robust; otherwise mixed. These labels do not measure distribution width or prove skill. An original sample return of exactly 0% is reported separately, even if its re-draws vary.
  3. Drawdown, 95th percentile — the empirical 95th percentile of each sampled path's maximum drawdown at closed-trade equity steps. It is neither the largest observed drawdown nor a maximum possible loss; some of these re-draws can be worse, and future losses can exceed it. Intra-trade and open-position drawdowns are excluded. A nonzero ruin share describes sampled paths that reached zero equity under this model, not future account-ruin probability.

How to use them together

  1. Read the free Reality check first — if it already says the sample is tiny or costs are missing, fix that before validating.
  2. Walk-forward compares the unchanged strategy across separate periods; Monte Carlo shows outcomes conditional on re-drawing its saved trade returns. Neither establishes that the strategy was selected independently of these data.
  3. Read the source sample, empirical range, positive share and drawdown together. Passing a label threshold does not prove a trading edge, independence or reliability.