bracket_walk_forward
Perform walk-forward optimization to evaluate trading strategies by training on historical folds and testing on unseen segments, generating a performance verdict.
Instructions
True walk-forward optimization — THE gate a strategy must pass before paper trading.
Splits history into sequential folds. In each fold the best (rr, atr_mult) is picked on the train window, then applied ONLY to the unseen test window; positions are force-closed at segment boundaries so nothing leaks. The aggregated out-of-sample result is the honest estimate of live behaviour. Verdicts: PASSED | MIXED | OVERFIT | NO_EDGE, plus parameter-stability (do folds keep choosing the same parameters?).
Args: symbol: Binance pair, e.g. BTCUSDT strategy: squeeze_breakout | ema_momentum interval: 1m | 3m | 5m | 15m | 30m | 1h | 4h | 1d days: History window, 1-730 (default 365; use ≥180 for 1h) direction: both | long | short n_splits: Number of sequential folds, 2-10 (default 4) train_ratio: Train fraction per fold, 0.5-0.9 (default 0.7) rr_values: Reward:risk grid (default [1.0, 1.5, 2.0, 3.0], max 8) atr_mult_values: Stop-distance grid in ATR multiples (default [1.0, 1.5, 2.0, 3.0]) min_trades: Minimum train trades for a combo to be eligible (default 5) max_hold_bars: Time-stop in bars (default 60) fee_pct: Fee % per side (default 0.05) slippage_pct: Slippage % per side (default 0.02) regime_filter: Gate signals by anchor trend (see bracket_backtest) regime_anchor: Anchor symbol (default BTCUSDT; "self" = traded pair) regime_interval: Anchor timeframe (default 4h)
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| days | No | ||
| symbol | Yes | ||
| fee_pct | No | ||
| interval | No | 1h | |
| n_splits | No | ||
| strategy | No | squeeze_breakout | |
| direction | No | both | |
| rr_values | No | ||
| min_trades | No | ||
| train_ratio | No | ||
| slippage_pct | No | ||
| max_hold_bars | No | ||
| regime_anchor | No | BTCUSDT | |
| regime_filter | No | ||
| atr_mult_values | No | ||
| regime_interval | No | 4h |