Back to MCP catalog
walk_forward

Validate strategy robustness across sequential out-of-sample windows.

Area

Backtesting & Validation

Group

Robustness

Access

Write

Risk

May change server state

Details

Full description

Run a walk-forward analysis to validate strategy robustness out-of-sample. Walk-forward divides a historical period into N sequential windows and backtests each to measure consistency across regimes.

Workflow

walk_forward(strategy_id, total_lookback="1yr", windows=5)   # → walk_forward_id
get_walk_forward(walk_forward_id)                            # poll until completed

Level 1 (consistency check) — no sweep; runs the strategy as-is on each window. Reports oos_sharpe_mean, oos_sharpe_std, pct_profitable_windows. Despite the oos_ prefix these are WHOLE-WINDOW metrics: Level 1 does no in-sample/out-of-sample split, so they measure consistency across regimes and are never out-of-sample evidence. High mean + low std = robust across regimes; pct_profitable_windows > 0.75 is strong, < 0.5 is concerning.

Level 2 (rolling re-optimization) — requires a sweep config. Each window splits into in-sample (IS) and out-of-sample (OOS): the sweep runs on IS, params are selected by select_by (sharpe_ratio | sortino_ratio | total_pnl_pct | win_rate), then applied to the OOS period. Reports Walk-Forward Efficiency (WFE = OOS Sharpe / IS Sharpe: > 0.5 strong, 0.3–0.5 acceptable, < 0.3 suggests overfitting) plus parameter stability — params that hold steady across windows suggest real signal.

Portfolios — pass portfolio_id instead of strategy_id. Portfolio walk-forward is Level 1 only (one coupled backtest per window with a per-member breakdown); it does not support sweep / overrides / oos_pct / select_by.

Key params — total_lookback (e.g. "1yr", "2yr", "6mo"), windows, mode (rolling or anchored, default rolling), oos_pct (Level 2 only), initial_cash (default 100000), fee_pct / slippage_pct (omit for the asset-aware default — 0.00%/0.01% equities, 0.50%/0.05% crypto; equity windows ALSO pay a per-symbol typical half-spread of 0.5-2bp on top, waived only when fee_pct and slippage_pct are BOTH sent as 0).

Capabilities

Bounded options and operating modes surfaced above the full JSON schema.

No bounded capability options are declared for this tool.

Required Inputs

None.

Optional Inputs

benchmark_symbolanyOf (2 variants)Optional secondary market-index benchmark (e.g. 'SPY'). When set, each window's child backtest reports market_benchmark_* fields alongside the per-symbol buy-and-hold benchmark.
fee_pctanyOf (2 variants)Trading fee as percentage (0.1 = 0.1%). None=auto-detect (equities=0.00%; crypto/mixed=0.50%). Set 0 for zero fees.
initial_cashnumberInitial cash for each backtest window
modestringWindow layout: 'rolling' (each window shifts forward by one window length) or 'anchored' (IS start is fixed, OOS end advances). Default: rolling
oos_pctnumberFraction of each window reserved for out-of-sample testing (Level 2 only). 0.25 = 25% OOS, 75% IS.
overridesanyOf (2 variants)Optional strategy-wide per-run override patch, applied to EVERY child window backtest (same shape as run_backtest overrides — distinct from sweep's per-variant 'overrides'). Example: {"sizing":{"mode":"fixed_usd","fixed_usd":5000},"execution":{"order_type":"market"}}
portfolio_idanyOf (2 variants)Portfolio identifier to analyze. Mutually exclusive with strategy_id. Portfolio walk-forward is Level 1 only (no sweep / overrides / oos_pct / select_by).
select_bystringMetric used to select the parameter set in each IS window (Level 2). Options: 'sharpe_ratio', 'sortino_ratio', 'total_pnl_pct', 'win_rate'.
slippage_pctanyOf (2 variants)Slippage as percentage (0.05 = 0.05%). None=auto-detect (equities=0.01%; crypto/mixed=0.05%). Equity runs ALSO pay a per-symbol typical half-spread (0.5-2bp) on top of this; it is only waived when fee_pct and slippage_pct are BOTH set to 0, so setting slippage alone to 0 is not a frictionless run.
strategy_idanyOf (2 variants)Strategy identifier to analyze. Mutually exclusive with portfolio_id.
sweepanyOf (2 variants)Parameter sweep config for Level 2 re-optimization. Only list-valued condition patch fields are swept axes; top-level initial_cash/fee_pct/slippage_pct are NOT swept here and are rejected. mode='random_sample' needs sample_size (and takes an optional seed); 'zip_by_index' needs every axis to be the same length. Example: {"mode": "cartesian", "overrides": {"conditions": [{"label": "entry.rsi", "patch": {"kind": "compare", "right": [25, 30, 35]}}]}}
total_lookbackstringTotal historical window for the analysis: '1yr', '2yr', '6mo', etc. This is divided into N windows. Longer lookbacks give more windows but require more data. Default: 2yr
windowsintegerNumber of time windows to divide the lookback into. Default: 6
Quawd

A subscription SaaS platform for designing, backtesting, and paper-trading algorithmic trading strategies on equities and crypto — described in plain English to an AI agent, no code required.

© 2026 Quawd. All rights reserved.

Quawd is a software tool, not a broker-dealer or investment adviser, and does not provide investment advice. Trading involves substantial risk of loss. Backtested and hypothetical results have inherent limitations and are not indicative of future performance.