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.
Source
backtester/walkforward/LayerValidation
ModeWorks with portfolio results
Inputportfolio data, folds, optimization configuration
Outputfold results, OOS metrics, overfit diagnostics, DSR/PBO where available
Primary API
WalkForwardEngine(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
| Metric | Question |
|---|---|
| OOS Sharpe | Does the strategy survive outside training windows? |
| Sharpe decay | How much does performance degrade OOS? |
| Efficiency | How much of IS behavior carries into OOS? |
| Overfit ratio | Is IS performance much stronger than OOS? |
| PBO | How likely is the selection process overfit? |
| Deflated Sharpe | Is 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.