QuantJourney Backtester

QuantJourney Backtester

Share product feedback

✓

Thank you.

Your note is now in the QuantJourney inbox.

docs/engine/walk-forward-optimization.mdx

Walk-Forward and Optimization

How QuantJourney validates strategy behavior across train/test folds and overfit diagnostics.

Walk-forward validation is not an execution mode. It is a validation layer used after a strategy has produced a portfolio path.

Sourcebacktester/walkforward/
LayerValidation
ModeWorks with portfolio results
Inputportfolio data, folds, optimization configuration
Outputfold results, OOS metrics, overfit diagnostics, DSR/PBO where available
Primary APIWalkForwardEngine(config).run(portfolio_data)
Main caveatWalk-forward can expose overfit; it cannot rescue non-causal signals or bad data.

Engine Contract

Walk-forward asks: "Does the strategy survive repeated train/test splits?" It should come after the engine contract is understood: data, signals, weights or orders, costs and NAV.

full backtest result -> fold scheme -> in-sample / out-of-sample slices -> fold metrics -> aggregate OOS metrics -> DSR / PBO / overfit diagnostics

Level 1: Rolling Walk-Forward

Validate an existing portfolio path
python
from backtester.walkforward import WalkForwardConfig, WalkForwardEngine

config = WalkForwardConfig(
    scheme="rolling",
    train_months=24,
    test_months=6,
    purge_days=5,
)

engine = WalkForwardEngine(config=config)
result = engine.run(strategy.portfolio_data)

print(result.summary())

Level 2: What To Inspect

MetricQuestion
OOS SharpeDoes the strategy survive outside training windows?
Sharpe decayHow much does performance degrade OOS?
EfficiencyHow much of IS behavior carries into OOS?
Overfit ratioIs IS performance much stronger than OOS?
PBOHow likely is the selection process overfit?
Deflated SharpeIs Sharpe still meaningful after selection effects?

Failure Modes

  • Optimizing parameters on the full sample and then calling the same sample OOS.
  • Running walk-forward on a strategy that already has look-ahead bias.
  • Ignoring transaction costs during optimization.
  • Comparing strategies with different universe or data availability assumptions.
  • Treating one strong fold as robust evidence.