Skip to content

Conversation

@SamoraDC
Copy link
Owner

No description provided.

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)
- Updated strategy comparison results from latest backtest run
- Made autonomous_trading_system.sh executable
Implemented multiple trading strategies with both long and short capabilities:

- TrendMomentumStrategy: Trend-following strategy with MACD, RSI, and EMA
  - Best single-stock (GOOGL): 0.51 Sharpe, 3.94% return, 50% win rate
  - Multi-stock: 0.32 Sharpe, 3.66% return, profit factor 1.55

- QuantitativeStrategy: Statistical z-score based strategy
  - Supports both long and short operations
  - Regime-aware position sizing
  - Asymmetric risk management (tighter stops for shorts)

- MLEnsembleStrategy: ML-based approach (data limited for full training)
  - Random Forest, GBM, XGBoost ensemble
  - Feature engineering with 50+ technical indicators

Key findings:
- Underlying stocks had Sharpe 0.71-1.64 as buy-and-hold
- Active trading adds volatility, making Sharpe 1.2 target challenging
- Best approach: Patient trend-following with wide stops and high targets

Fixed issues:
- Fixed missing Optional import in cross_validator.py
- Fixed imports in ml/features/__init__.py
@SamoraDC SamoraDC merged commit 0044171 into main Dec 17, 2025
1 of 13 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants