walk_forwardMeasure consistency across regimes or rolling out-of-sample performance.
Area
Backtesting & Validation
Group
Robustness
Access
Write
Risk
May change server state
▸Details
Full description
Details
Analyze a strategy or portfolio across historical windows.
Once results are in, record the run ID, reported metrics, and relevant caveats with add_project_note so the evidence can be found across sessions.
Walk-forward testing divides a historical period into N sequential windows, running backtests on each to measure consistency across regimes.
Folds never enter the project's reserved holdout: if total_lookback
would reach into it, the whole walk-forward window is moved earlier —
keeping its full requested length, so the fold count and fold length are
unchanged — and warnings carries a holdout_window_shifted notice. A
total_lookback that lands entirely inside the holdout is rejected
rather than quietly shortened.
Portfolios: pass portfolio_id instead of strategy_id. Portfolio walk-forward is Level 1 only — each window runs one coupled portfolio backtest across all members (with a per-member breakdown). It does not support axes / assignments / oos_pct / select_by (portfolios have no parameter sweep).
Two analysis levels:
Level 1 (consistency check): Tests the same strategy across N time windows. No sweep required — uses the strategy as-is on each window. This is whole-window consistency analysis; it has no in-sample/out-of-sample split. Reports per-window results and aggregate Sharpe and profitable-window measures. These summarize the selected windows and do not determine whether the strategy is suitable for a particular use.
Level 2 (rolling re-optimization): Re-optimizes on each IS window, tests on OOS. Requires research axes to define the parameter space. Walk-Forward Efficiency (WFE) = OOS Sharpe / IS Sharpe. The reported WFE describes the ratio of OOS to IS Sharpe across windows; inspect the per-window values and selected parameters. Parameter stability reports how selected parameters vary across windows.
Workflow:
- walk_forward(strategy_id, total_lookback="1yr", windows=5) → returns run_id
- get_run(kind="walk_forward", run_id=run_id) → poll until status="completed"
- Interpret level-specific aggregates (window_sharpe_mean for Level 1; oos_sharpe_mean and wfe_mean for Level 2).
Level 1 (no sweep):
- Divides total_lookback into N equal windows
- Runs one backtest per window with the unchanged strategy
- Reports window_sharpe_mean, window_sharpe_std, window_sharpe_valid_windows and pct_profitable_windows. Sharpe is a whole-window consistency measure, not out-of-sample evidence.
Level 2 (with sweep):
- Each window is split into IS (in-sample) and OOS (out-of-sample)
- IS: runs the parameter sweep, selects params by the configured select_by metric
- OOS: runs the selected params on the OOS period
- Reports wfe_mean, parameter_stability, pct_profitable_windows
Size limit: every fold of every candidate is one job of at most 50,000 estimated bar-rows (bars x symbols), and a walk-forward's summed folds (every candidate's IS folds plus one OOS fold per window) may not exceed 500,000. Over either, the refusal names the estimate: use fewer combinations or windows, a shorter total_lookback, a coarser timeframe or fewer symbols.
Returns run_id, status, total_backtests and level. Available on every signed-in plan; a guest session is refused with UNAUTHORIZED. Refuses with STRATEGY_NOT_FOUND when the strategy does not exist, VALIDATION_ERROR when parameters are invalid, and EXECUTION_SERVICE_ERROR when the run service fails.
Capabilities
Bounded options and operating modes surfaced above the full JSON schema.
Mode options
mode
rollinganchoredSelect By options
select_by
pnl.net_profitpnl.end_equitypnl.realized_pnlpnl.total_returnpnl.realized_returnpnl.open_running_returnequity.annual_returnequity.max_drawdownequity.max_drawdown_barsequity.annual_standard_deviationequity.annual_downside_deviationequity.sharpe_ratioequity.sortino_ratioequity.skewnessequity.kurtosisequity.calmar_ratioequity.recovery_factortrades.win_ratetrades.loss_ratetrades.expectancytrades.average_maetrades.average_mfetrades.largest_maetrades.largest_mfetrades.max_consecutive_lossestrades.average_wintrades.average_losstrades.profit_loss_ratiotrades.profit_factorrefreshed.value_at_risk_95refreshed.cvar_95refreshed.first_half_excess_return_vs_buy_and_holdrefreshed.second_half_excess_return_vs_buy_and_holdrefreshed.sub_period_ratiobuy_and_hold.excess_return_vs_buy_and_holdmarket.alpha_jensenmarket.alpha_jensen_annualizedmarket.information_ratiomarket.treynor_ratiorisk.risk_halt_countrisk.risk_signals_skippedrisk.entries_cash_clampedrisk.entries_sizing_cappedrisk.capital_violationsRequired Inputs
Optional Inputs
assignmentsarray<oneOf (2 variants)>Fixed research target values applied to every window. A run/start_date or run/end_date value is a calendar date (YYYY-MM-DD), never a timestamp.axesarray<oneOf (2 variants)>Research target axes for Level 2. Discover paths with get_strategy(include=['parameters']).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. Allowed percent range: 0 <= value <= 5.initial_cashnumberInitial cash for each backtest windowmax_combinationsanyOf (2 variants)Level 2 only: ceiling on the combinations tested, up to 200; a larger grid is refused.modeenum: rolling, anchoredWindow layout: 'rolling' (each window shifts forward by one window length) or 'anchored' (IS start is fixed, OOS end advances). Default: rollingoos_pctnumberFraction of each window reserved for out-of-sample testing (Level 2 only). 0.25 = 25% OOS, 75% IS.portfolio_idanyOf (2 variants)Portfolio identifier to analyze. Mutually exclusive with strategy_id. Portfolio walk-forward is Level 1 only (no axes / assignments / oos_pct / select_by).sample_sizeanyOf (2 variants)Level 2 only: how many parameter combinations a sampling sweep_mode draws; omit for a full grid.seedanyOf (2 variants)Level 2 only: seed that makes a sampling sweep_mode repeatable.select_byWalkForwardSelectionMetricRun statistic that selects the parameter set in each IS window (Level 2), named as get_run reports it, e.g. 'equity.sharpe_ratio', 'pnl.total_return', 'equity.max_drawdown', 'trades.win_rate'. Each metric's own direction decides which end wins: equity.max_drawdown picks the shallowest drawdown.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. Allowed percent range: 0 <= value <= 5.strategy_idanyOf (2 variants)Strategy identifier to analyze. Mutually exclusive with portfolio_id.sweep_modeanyOf (2 variants)How research axes combine; separate from rolling/anchored mode.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. Backtest windows are capped per plan (as short as 1,826 days, about 5 years); a longer request is refused with the earliest allowed start date.windowsintegerNumber of time windows to divide the lookback into (2-20). Default: 6