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>
PROBLEM:
- execute_trade_v2_adaptive didn't accept pre-calculated signal_info
- Function did its own signal analysis internally
- Trying to pass entry_signal/signal_info caused parameter errors
SOLUTION:
- Added optional parameters: signal_info_override, confidence_override
- If provided, function uses pre-calculated values
- If not provided, function calculates values itself (backward compatible)
CHANGES:
- Cell 28: Added new parameters to function signature
- Cell 28: Use signal_info_override if provided
- Cell 28: Use confidence_override if provided
- Cells 85, 90: Updated execute_trade calls to use new parameters
- activate_enhanced_scoring.py: Updated to use new parameters
Now enhanced_trading_check_wrapper can pass its hybrid confidence
score to execute_trade_v2_adaptive properly.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
CRITICAL BUG:
- extended_top_down_v2_adaptive returns entry_signal as NUMBER (1, -1, 0)
- enhanced_trading_check_wrapper checked for STRINGS ("LONG", "SHORT")
- Result: 1 in ["LONG", "SHORT"] = False → NO TRADES EVER EXECUTED!
FIX:
- Changed: if entry_signal in ["LONG", "SHORT"]
- To: if entry_signal in [1, -1] # 1=LONG, -1=SHORT
- Added signal_direction conversion before execute_trade call
This explains why no trades were being executed despite good signals!
Updated:
- TradingBot_V1.6_Adaptive_Complete_CORRECTED.ipynb (Cells 85, 90)
- activate_enhanced_scoring.py
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
PROBLEM:
- Enhanced Score alone (67.8%) was blocking trades with high Base Confidence (97.5%)
- Low Volume Score (40/100) was dragging down the total
- Good trading setups were being rejected
SOLUTION: Hybrid 60/40 Approach
- Final Score = (Base Confidence × 60%) + (Enhanced Score × 40%)
- The proven trend analysis system keeps primary weight (60%)
- Enhanced scoring still filters bad setups (40%)
EXAMPLE:
- Base Confidence: 97.5%
- Enhanced Score: 67.8%
- OLD: final = 67.8% (blocked at 70% threshold)
- NEW: final = (97.5 × 0.6) + (67.8 × 0.4) = 85.6% (passes!)
BENEFITS:
- Respects the proven base trend system
- Enhanced scoring still adds value
- Fewer false rejections of good trades
- Better balance between filtering and opportunity
Updated files:
- TradingBot_V1.6_Adaptive_Complete_CORRECTED.ipynb (Cells 85, 90)
- activate_enhanced_scoring.py
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Fixed NameError in enhanced trading check:
- check_existing_position() does not exist
- Correct function is check_existing_positions() (with 's')
Fixed in:
- activate_enhanced_scoring.py
- Notebook cells 84 and 89
Error resolved: NameError: name 'check_existing_position' is not defined