Strategy research methods

Walk-forward optimization with a real four-fold calendar

Preview a walk-forward plan in NexusTrade, inspect its training, validation, embargo and later test dates, and preserve each selected strategy.

As of 2026-10-10

1. Build and save the exact example seed

Download the public JSON linked below and copy its portfolioConfiguration object, including both strategies, into build_portfolio. This builder validates the draft and returns valid, issues and canonical portfolio output without saving it. Continue only when valid is true and issues are resolved.

Send that same complete object to create_portfolio to save a research draft. Keep the returned portfolio ID, then call get_portfolio with portfolio_id set to that ID. Confirm initialValue 10000, supportsFractionalShares false, dividendPolicy cash, the two strict moving-average comparisons and both PositionValue guards. This saves a draft; it does not activate automated trading.

Use your own returned ID in the preview request. Do not copy an example account or study identifier. If creation is interrupted, inspect fetch_portfolios and get_portfolio before trying again so you do not silently create a duplicate seed.

Select before advancing the clock

A walk-forward study repeats development and later evaluation across chronological folds. Training builds candidates; validation selects among them; the outer test evaluates the selected frozen candidate on later dates. Anchored training expands from the same beginning. Rolling training moves its beginning forward. These choices ask different questions and belong in the experiment record.

The example here is a fixed-book calendar example, created on October 10, 2026. Its configured folds use the same GOOG 50/200 book. No mutation or winner search was needed, so repeated fixed_book selections cannot establish that an optimizer found a stable winner.

The first fold's information boundary

Training2016-01-01T05:00:00Z to 2021-10-03T03:59:59.999ZDevelop or fit candidates
Embargo2021-10-03T04:00:00Z to 2021-10-17T03:59:59.999ZExcluded gap between training and validation
Validation2021-10-17T04:00:00Z to 2023-03-30T03:59:59.999ZChoose a candidate before its outer test
Outer test2023-03-30T04:00:00Z to 2023-12-07T04:59:59.999ZEvaluate the frozen candidate

Dates come from the actual plan. UTC boundaries reflect the generated market calendar; preserve them instead of hand-rounding an adjacent day into both windows.

Preview an exact-book study before launching it

Connect through the Developers page, read back your own draft portfolio and replace the placeholder with its returned ID. Submit this object to run_walk_forward_study. preview_only compiles the plan without creating a study or charging study tokens. Inspect folds, plannedUnits and estimatedTokenCost. The preview validates a plan; it does not return completed performance.

{
  "portfolio_id": "<your verified portfolio ID>",
  "global_start_date": "2016-01-01",
  "global_end_date": "2025-12-31",
  "fold_count": 4,
  "training_percent": 60,
  "validation_percent": 20,
  "embargo_days": 14,
  "engine_kind": "ga",
  "inner_mode": "backtest_only",
  "mode": "validation",
  "interval": "Day",
  "preview_only": true
}

Check the calendar, then approve the actual run

Verify training ends before the embargo, validation starts after it, and each outer test begins after validation. Read the generated timestamps rather than assuming a percentage divides your chosen global calendar in an obvious way. Review warmup needs for the 200-observation average and record whether test windows overlap.

Launching requires a separate request with preview_only false and the frozen inputs. Save the returned studyId. Ask get_walk_forward_study_results with study_id set to that actual ID; do not submit a second launch because the first response is slow. That results tool can materialize winner portfolios in your account, so it is not a strictly read-only public data accessor.

Interpret each fold and the aggregate separately

The validation mode uses separate test books with fresh capital. Multiplying the returns does not reproduce a continuous deployed account. Adaptive mode has a different stitched-policy interpretation and cannot be inferred from this validation-mode receipt.

Inspect per-fold candidate identity, floor warnings, drawdown, activity and the equity path. Overlapping test windows share observations; their count overstates independent evidence. A retrospective cross-fold candidate summary is useful for diagnosis, but choosing a winner using all outer results is another selection step.

Reserve a final untouched window

If you will use the walk-forward results to redesign the book, reserve a later lockbox outside every fold and every search. Freeze the final assembled portfolio before opening it. Record a failed lockbox as a failure; changing the rule and rerunning the same lockbox consumes it as validation.

Continue exploring