You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Fix critical backtesting bugs causing infinite position accumulation
BUGS FIXED:
1. Execution handler was using $100 default price for market orders
instead of actual market prices, causing cascading calculation errors
2. Signal generation was processing ALL historical bars on each market
event, causing signals to accumulate exponentially
3. Performance metrics formatting was double-multiplying percentages
CHANGES:
- execution_handler.py: Added set_data_handler() to get actual prices
- engine.py: Connect data handler to execution handler
- momentum.py, momentum_simplified.py, mean_reversion.py, trend_following.py:
Added latest_only parameter to generate_signals() to only process
the latest bar during live backtesting
- run_router_backtest.py: Fixed percentage display formatting
TESTING:
- Backtest now completes in ~2.7s with 65 trades
- Metrics are now reasonable (7.88% max drawdown, 41.54% win rate)
0 commit comments