walk_forward_backtest
Validate a trading strategy out-of-sample and detect curve-fitting by testing on unseen data in multiple folds. Optimizes on past data, scores future folds, and compares results for a verdict.
Instructions
Validate a strategy out-of-sample and check whether it is curve-fitted.
Args: symbol: Ticker. strategy: Strategy name from list_strategies. market: "crypto", "stock" or "idx". interval: Candle size. bars: Candles to use. Needs roughly 40 x (folds + 1) minimum. folds: Number of out-of-sample test windows (2-10). objective: Metric the parameter search optimises for. fee_bps: Fee in basis points per position change. slippage_bps: Slippage in basis points per position change.
Optimises parameters on data up to each fold, then scores the fold that
follows on bars the optimiser never saw. The verdict compares in- and
out-of-sample results: this is the tool that catches a strategy that only
looks good in hindsight.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| bars | No | ||
| folds | No | ||
| market | No | crypto | |
| symbol | Yes | ||
| fee_bps | No | ||
| interval | No | 1d | |
| strategy | Yes | ||
| objective | No | sharpe | |
| slippage_bps | No |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||