QuantJourney Backtester

QuantJourney Backtester

Share product feedback

✓

Thank you.

Your note is now in the QuantJourney inbox.

WF03 · example_wf_03_anchored_purge_embargo.py

WF03 Anchored Walk-Forward With Pre-OOS Purging

Inspect a weekly RSI mean-reversion strategy with an ANCHORED walk-forward, using a fixed purge plus a percentage extension before each OOS window.

What this example shows

This example shows how to build a workflow-level walk-forward validation research example with fold construction, parameter selection, diagnostics, logging and evidence capture.

The goal is educational: to demonstrate the full workflow for validation setup, search space definition, fold diagnostics, objective tracking and reproducible run logging.

Walk-forward diagnostic. 48-fold slice diagnostic from one full-period run. It demonstrates window construction, pre-OOS purging and diagnostic reporting, but it is not an independent per-fold refit or out-of-sample result.

Run setup

The ordinary configuration used by the published run—kept visible here and in the Python source.

UniverseXLB · XLE · XLF · XLI · XLK · XLP · XLU · XLV · XLY
Configured period2000-01-03 → 2026-01-01
BenchmarkSPY · SPDR S&P 500 ETF Trust
Initial capital$100,000
Data sourceyfinance
Engine / snapshot0.10.0 · a35f582c47dcd036
Walk-forward / OptimizationMode
1dGranularity
9Instruments
0Published plots
passedRun status

Dashboard

Compact evidence view built from the same run packet: metrics, plots and run metadata.

48 Folds
Slice diagnostic Mode
12/48 Negative slices

Metrics

This workflow emits diagnostics rather than a standard performance table.

Walk-forward diagnostic. 48-fold slice diagnostic from one full-period run. It demonstrates window construction, pre-OOS purging and diagnostic reporting, but it is not an independent per-fold refit or out-of-sample result.

Artifacts

Stable links that can be referenced from GitHub README files or external docs.

Run log

Tail of the execution log for this packet.

  26 │ 2000-01 → 2015-01       │      0.29 │ 2015-01 → 2015-07       │       0.63
  27 │ 2000-01 → 2015-07       │      0.29 │ 2015-07 → 2015-12       │       0.10
  28 │ 2000-01 → 2015-12       │      0.25 │ 2016-01 → 2016-07       │       0.84
  29 │ 2000-01 → 2016-07       │      0.28 │ 2016-07 → 2016-12       │       1.92
  30 │ 2000-01 → 2016-12       │      0.31 │ 2017-01 → 2017-06       │      -0.74
  31 │ 2000-01 → 2017-06       │      0.32 │ 2017-07 → 2018-01       │       3.74
  32 │ 2000-01 → 2018-01       │      0.32 │ 2018-01 → 2018-07       │       0.86
  33 │ 2000-01 → 2018-07       │      0.33 │ 2018-07 → 2019-01       │      -0.71
  34 │ 2000-01 → 2019-01       │      0.35 │ 2019-01 → 2019-07       │       2.52
  35 │ 2000-01 → 2019-07       │      0.33 │ 2019-07 → 2020-01       │       1.66
  36 │ 2000-01 → 2020-01       │      0.35 │ 2020-01 → 2020-07       │      -0.00
  37 │ 2000-01 → 2020-07       │      0.37 │ 2020-07 → 2020-12       │       1.97
  38 │ 2000-01 → 2020-12       │      0.33 │ 2021-01 → 2021-07       │       3.93
  39 │ 2000-01 → 2021-07       │      0.35 │ 2021-07 → 2021-12       │       2.50
  40 │ 2000-01 → 2021-12       │      0.37 │ 2022-01 → 2022-07       │      -0.04
  41 │ 2000-01 → 2022-07       │      0.41 │ 2022-07 → 2022-12       │       1.02
  42 │ 2000-01 → 2022-12       │      0.39 │ 2023-01 → 2023-06       │       2.31
  43 │ 2000-01 → 2023-06       │      0.41 │ 2023-07 → 2024-01       │       1.60
  44 │ 2000-01 → 2024-01       │      0.43 │ 2024-01 → 2024-07       │       2.80
  45 │ 2000-01 → 2024-07       │      0.45 │ 2024-07 → 2025-01       │       0.14
  46 │ 2000-01 → 2025-01       │      0.46 │ 2025-01 → 2025-07       │       0.76
  47 │ 2000-01 → 2025-07       │      0.46 │ 2025-07 → 2025-12       │       1.49
────────────────────────────────────────────────────────────────────────────────
AGGREGATE (IN-SAMPLE SLICES — not OOS)
  Composite Sharpe (IS slice): 0.46 [5%: 0.16, 95%: 0.80]
  CAGR (IS slice):         5.9%    Overfit Ratio: 0.26
  Max DD (IS slice):     -49.2%    Efficiency:    1.92
  Sharpe Decay:         +0.023/fold
  Deflated Sharpe:      n/a (in-sample; DSR not meaningful without independent trials)
  PBO:                       n/a
    (PBO unavailable: requires per-trial OOS evaluation; set WalkForwardConfig.pbo_trials=K (>=2) with an optimizer to evaluate top-K trials OOS per fold)

WARNINGS
  ⚠ PBO unavailable: requires per-trial OOS evaluation; set WalkForwardConfig.pbo_trials=K (>=2) with an optimizer to evaluate top-K trials OOS per fold
  ⚠ Walk-forward mode=slice_diagnostics: metrics are computed from a full-period NAV; pass backtester_factory for per-fold refit.
  ⚠ Fold 0: slice diagnostics mode — metrics are sliced from the full-period NAV (no per-fold refit)
  ⚠ Fold 0: OOS Sharpe -0.94 is negative
  ⚠ Fold 0: overfit ratio inf > 2.5
  ⚠ Fold 1: slice diagnostics mode — metrics are sliced from the full-period NAV (no per-fold refit)
  ⚠ Fold 1: OOS Sharpe -0.27 is negative
  ⚠ Fold 1: overfit ratio inf > 2.5
  ⚠ Fold 2: slice diagnostics mode — metrics are sliced from the full-period NAV (no per-fold refit)
  ⚠ Fold 3: slice diagnostics mode — metrics are sliced from the full-period NAV (no per-fold refit)
  ⚠ Fold 4: slice diagnostics mode — metrics are sliced from the full-period NAV (no per-fold refit)
  ⚠ Fold 5: slice diagnostics mode — metrics are sliced from the full-period NAV (no per-fold refit)
  ⚠ Fold 6: slice diagnostics mode — metrics are sliced from the full-period NAV (no per-fold refit)
  ⚠ Fold 6: OOS Sharpe -0.10 is negative
  ⚠ Fold 6: overfit ratio inf > 2.5
  ⚠ Fold 7: slice diagnostics mode — metrics are sliced from the full-period NAV (no per-fold refit)
  ⚠ Fold 8: slice diagnostics mode — metrics are sliced from the full-period NAV (no per-fold refit)
  ⚠ Fold 8: overfit ratio 4.9 > 2.5
  ⚠ Fold 9: slice diagnostics mode — metrics are sliced from the full-period NAV (no per-fold refit)
  ⚠ Fold 10: slice diagnostics mode — metrics are sliced from the full-period NAV (no per-fold refit)
  ⚠ Fold 11: slice diagnostics mode — metrics are sliced from the full-period NAV (no per-fold refit)
  ⚠ Fold 11: OOS Sharpe -0.03 is negative
  ⚠ Fold 11: overfit ratio inf > 2.5
  ⚠ Fold 12: slice diagnostics mode — metrics are sliced from the full-period NAV (no per-fold refit)
  ⚠ Fold 12: OOS Sharpe -0.54 is negative
  ⚠ Fold 12: overfit ratio inf > 2.5
  ⚠ Fold 13: slice diagnostics mode — metrics are sliced from the full-period NAV (no per-fold refit)
  ⚠ Fold 13: OOS Sharpe -0.87 is negative
  ⚠ Fold 13: overfit ratio inf > 2.5
  ⚠ Fold 14: slice diagnostics mode — metrics are sliced from the full-period NAV (no per-fold refit)
  ⚠ Fold 14: OOS Sharpe -0.67 is negative
  ⚠ Fold 14: overfit ratio inf > 2.5
  ⚠ Fold 15: slice diagnostics mode — metrics are sliced from the full-period NAV (no per-fold refit)
  ⚠ Fold 16: slice diagnostics mode — metrics are sliced from the full-period NAV (no per-fold refit)
  ⚠ Fold 16: OOS Sharpe -0.18 is negative
  ⚠ Fold 16: overfit ratio inf > 2.5
  ⚠ Fold 17: slice diagnostics mode — metrics are sliced from the full-period NAV (no per-fold refit)
  ⚠ Fold 18: slice diagnostics mode — metrics are sliced from the full-period NAV (no per-fold refit)
  ⚠ Fold 19: slice diagnostics mode — metrics are sliced from the full-period NAV (no per-fold refit)
  ⚠ Fold 20: slice diagnostics mode — metrics are sliced from the full-period NAV (no per-fold refit)
  ⚠ Fold 21: slice diagnostics mode — metrics are sliced from the full-period NAV (no per-fold refit)
  ⚠ Fold 22: slice diagnostics mode — metrics are sliced from the full-period NAV (no per-fold refit)
  ⚠ Fold 23: slice diagnostics mode — metrics are sliced from the full-period NAV (no per-fold refit)
  ⚠ Fold 24: slice diagnostics mode — metrics are sliced from the full-period NAV (no per-fold refit)
  ⚠ Fold 25: slice diagnostics mode — metrics are sliced from the full-period NAV (no per-fold refit)
  ⚠ Fold 26: slice diagnostics mode — metrics are sliced from the full-period NAV (no per-fold refit)
  ⚠ Fold 27: slice diagnostics mode — metrics are sliced from the full-period NAV (no per-fold refit)
  ⚠ Fold 27: overfit ratio 2.9 > 2.5
  ⚠ Fold 28: slice diagnostics mode — metrics are sliced from the full-period NAV (no per-fold refit)
  ⚠ Fold 29: slice diagnostics mode — metrics are sliced from the full-period NAV (no per-fold refit)
  ⚠ Fold 30: slice diagnostics mode — metrics are sliced from the full-period NAV (no per-fold refit)
  ⚠ Fold 30: OOS Sharpe -0.74 is negative
  ⚠ Fold 30: overfit ratio inf > 2.5
  ⚠ Fold 31: slice diagnostics mode — metrics are sliced from the full-period NAV (no per-fold refit)
  ⚠ Fold 32: slice diagnostics mode — metrics are sliced from the full-period NAV (no per-fold refit)
  ⚠ Fold 33: slice diagnostics mode — metrics are sliced from the full-period NAV (no per-fold refit)
  ⚠ Fold 33: OOS Sharpe -0.71 is negative
  ⚠ Fold 33: overfit ratio inf > 2.5
  ⚠ Fold 34: slice diagnostics mode — metrics are sliced from the full-period NAV (no per-fold refit)
  ⚠ Fold 35: slice diagnostics mode — metrics are sliced from the full-period NAV (no per-fold refit)
  ⚠ Fold 36: slice diagnostics mode — metrics are sliced from the full-period NAV (no per-fold refit)
  ⚠ Fold 36: OOS Sharpe -0.00 is negative
  ⚠ Fold 36: overfit ratio inf > 2.5
  ⚠ Fold 37: slice diagnostics mode — metrics are sliced from the full-period NAV (no per-fold refit)
  ⚠ Fold 38: slice diagnostics mode — metrics are sliced from the full-period NAV (no per-fold refit)
  ⚠ Fold 39: slice diagnostics mode — metrics are sliced from the full-period NAV (no per-fold refit)
  ⚠ Fold 40: slice diagnostics mode — metrics are sliced from the full-period NAV (no per-fold refit)
  ⚠ Fold 40: OOS Sharpe -0.04 is negative
  ⚠ Fold 40: overfit ratio inf > 2.5
  ⚠ Fold 41: slice diagnostics mode — metrics are sliced from the full-period NAV (no per-fold refit)
  ⚠ Fold 42: slice diagnostics mode — metrics are sliced from the full-period NAV (no per-fold refit)
  ⚠ Fold 43: slice diagnostics mode — metrics are sliced from the full-period NAV (no per-fold refit)
  ⚠ Fold 44: slice diagnostics mode — metrics are sliced from the full-period NAV (no per-fold refit)
  ⚠ Fold 45: slice diagnostics mode — metrics are sliced from the full-period NAV (no per-fold refit)
  ⚠ Fold 45: overfit ratio 3.2 > 2.5
  ⚠ Fold 46: slice diagnostics mode — metrics are sliced from the full-period NAV (no per-fold refit)
  ⚠ Fold 47: slice diagnostics mode — metrics are sliced from the full-period NAV (no per-fold refit)
  ⚠ 12/48 folds have OOS Sharpe below 0.0

NOTE: slice_diagnostics mode — the metrics above are IN-SAMPLE
slices of ONE full-period run, not out-of-sample evidence.
Set QJ_WF_MODE=per_fold_refit for honest OOS validation.

Walk-forward traffic lights (IN-SAMPLE — indicative only):
  MetricVerdict(name='overfit_ratio', value=0.2649033884528026, signal='green', description='< 1.5 — robust')
  MetricVerdict(name='efficiency', value=1.921108632787444, signal='green', description='> 0.7 — robust transfer')
  MetricVerdict(name='sharpe_decay', value=0.023476042871027544, signal='green', description='> -0.01/fold — stable')