equity_curve_trading.py:
- mt→mt5 alias in _get_current_equity()
- safe-fail: return False (block trade) when equity unavailable
- UTC timestamps via timezone.utc in update_equity()
- add_initial_equity(): unique timestamps (staggered by minute) instead of identical
infrastructure_patch.py:
- Add logging module, replace all print() with logger calls
- Fix guard: self.db/self.telegram instead of enable_database/enable_telegram
- Fix UTC bug in extract_trade_data_from_mt5() (fromtimestamp with tz=utc)
- Remove direct self.db.cursor.execute() in log_trade_exit() — use get_open_trades()
- Read risk_pct from SESSION_WHITELIST_CONFIG instead of hardcoding 0.01
news_filter.py / news_filter_v2.py:
- Remove both inactive variants (ForexFactory scraper + Finnhub API)
- news_filter_simple.py + news_filter_integration.py remain as active implementation
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
NEW MODULE: equity_curve_trading.py
- EquityCurveManager class for meta-strategy control
- Tracks equity history after each trade
- Calculates Moving Average over configurable period (default: 10 trades)
- Soft Mode: Reduces lot size to 50% when equity < MA
- Hard Mode: Completely stops trading when equity < MA
- Recovery detection with buffer percentage
- Persistent storage in equity_curve_history.json
CONFIGURATION:
- ma_period: 10 trades (Moving Average window)
- min_trades_required: 5 (warmup period)
- soft_mode: True (reduce lots instead of stopping)
- soft_mode_multiplier: 0.5 (50% lots when under MA)
- recovery_buffer_pct: 0.5% (buffer for recovery status)
INTEGRATION:
- Added to Cell 78 (Advanced Optimizations setup)
- Integrated in enhanced_trading_check_wrapper (Cells 85, 90)
- Added lot_multiplier parameter to execute_trade_v2_adaptive
- Equity update after each successful trade
EXAMPLE FLOW:
1. Before trade: Check should_trade() → returns (allowed, reason, lot_multiplier)
2. If equity < MA: lot_multiplier = 0.5 (or 0.0 in hard mode)
3. Position size adjusted: volume = volume * lot_multiplier
4. After trade: update_equity() called to track new equity
BENEFITS:
- Automatic protection during losing streaks
- Reduces exposure when strategy underperforms
- Capitalizes fully when strategy is working
- No emotional decisions needed
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>