Spaces:
Running
Running
Commit History
-
feat: add backtester and enable ranging-regime filter Running
Add an event-driven, no-look-ahead backtester (src/backtest) that reuses the live generateSignals/analyzeExit and exact cost formulas, fills SL/TP from intrabar high/low, and models the partial -> breakeven -> runner lifecycle. Includes an A/B preset runner and a robustness validator (per-symbol, in-sample/out-of-sample, fill-sensitivity). Backtest (~60-82d, 96 trades, pessimistic fills) shows that blocking ranging-regime setups improves profit factor 1.36->1.71, net +53%, expectancy ~2x, and cuts max drawdown - on all 4 symbols and both data halves. Enable it live via LIVE_STRATEGY_OPTS.blockRanging (default-off flag), wired into the server autopilot and the browser client. Revert by setting blockRanging:false. Also: export getSpread/calculateCommission from tradeManager for single-source reuse, and add an optional Yahoo range override so backtests can pull 60d of 15m data instead of the app's 15d default. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>f43243e