Skip to main content

Backtest Engine

b1e55ed includes a walk-forward backtesting engine for strategy validation.

Commands

Walk-forward

b1e55ed backtest walkforward \
  --symbols BTC,ETH,SOL \
  --strategies momentum,ma_crossover \
  --start 2023-01-01 \
  --end 2025-12-31
Runs a walk-forward test with FDR-corrected results. Outputs: Sharpe ratio, Sortino ratio, max drawdown, win rate per strategy/asset combination.

Grid sweep

b1e55ed backtest gridsweep \
  --strategies momentum \
  --assets BTC,ETH
Sweeps parameter combinations for a strategy. FDR correction applied across all combinations to control false discovery rate.

Mega sweep

b1e55ed backtest megasweep
Sweeps all strategies × all parameter combos × all assets. Runs in parallel. Produces ranked survivors after FDR correction.

Regime-conditioned

b1e55ed backtest regime --symbols BTC,ETH
Breaks performance down by detected regime (EARLY_BULL, LATE_BULL, BEAR, SIDEWAYS). Shows which strategies hold in each regime.

Dynamic Kelly

b1e55ed kelly
Estimates optimal position sizing from trade history using the Kelly criterion. Regime-adjusted.

Understanding results

MetricThresholdNotes
Sharpe > 0.5AcceptableAfter costs
Sharpe > 1.0GoodReproducible edge
Max DD < 25%AcceptableStrategy-dependent
Passes FDR q=0.05RequiredControls false discoveries
FDR correction is mandatory. A strategy that looks good on a single backtest is likely noise.

Key findings

Combined multi-factor strategies (momentum + MA crossover) outperform single-factor strategies after FDR correction. Pure momentum and pure RSI do not survive strict out-of-sample validation. See: architecture.md for how backtest results feed into the learning loop.