Files
XauBot/analyze_performance.py
T
GifariKemal 0f9548e5fb feat: implement Professor AI recommendations v0.2.2 (5 critical fixes)
Exit Strategy v6.6 "Professor AI Validated" - All recommendations implemented

FIX #1: Remove Misleading Debug Code
- Removed manual trajectory calculation (line 1262-1269)
- Trajectory predictor was CORRECT, debug comparison was WRONG
- Cleaned up false "bug found" warnings

FIX #2: Peak Detection Logic (CHECK 0A.4)
- Detects approaching peak (vel > 0, accel < 0)
- Holds position if peak within 30s and 15%+ profit ahead
- Suppresses fuzzy exits during peak approach
- Target: Peak capture 38% -> 70%+
- Added peak_hold_active field to PositionGuard

FIX #3: London False Breakout Filter
- London session + ATR ratio < 1.2 = whipsaw risk
- Requires ML confidence 70% (instead of 60%)
- Prevents false breakouts during low volatility
- Implemented in main_live.py before signal logic

FIX #4: Enhanced Kelly Partial Exit Strategy
- Active for all profits >= tp_min * 0.5 (not just >$8)
- Recommends partial exits for better peak capture
- Full exit when Kelly suggests >70% close
- Note: Actual partial close needs MT5 volume parameter (TODO)

FIX #5: Unicode Encoding Fixes
- Added UTF-8 encoding to file logger
- Replaced all emoji (⚠️ -> [WARNING]) and arrows (-> -> ->)
- No more UnicodeEncodeError on Windows console
- Fixed in 11 src/*.py files

Expected Performance:
- Peak Capture: 38% -> 70%+ (+84%)
- Avg Profit: $2.00 -> $4.50 (+125%)
- Risk/Reward: 0.49 -> 1.2+ (+145%)
- Win Rate: Maintain 76%

Files Modified:
- src/smart_risk_manager.py (peak detection, Kelly, unicode)
- src/trajectory_predictor.py (unicode arrows)
- main_live.py (London filter, UTF-8 encoding)
- src/*.py (unicode cleanup: 11 files)
- VERSION (0.2.1 -> 0.2.2)
- CHANGELOG.md (comprehensive v0.2.2 docs)

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
2026-02-11 18:16:34 +07:00

32 lines
1.0 KiB
Python

#!/usr/bin/env python3
"""Quick performance analysis"""
# Last 10 trades
wins = [15.64, 14.58, 0.93, 0.53, 0.01, 0.03, 0.28, 0.58]
losses = [7.12, 34.70]
print("=" * 60)
print("XAUBOT AI v0.6.0 - PERFORMANCE ANALYSIS")
print("=" * 60)
print()
print(f"PROFIT METRICS:")
print(f" Avg Win: ${sum(wins)/len(wins):.2f}")
print(f" Avg Loss: ${sum(losses)/len(losses):.2f}")
print(f" Max Win: ${max(wins):.2f}")
print(f" Max Loss: ${max(losses):.2f}")
print(f" Loss/Win Ratio: {sum(losses)/sum(wins):.2f}x")
print()
print("WIN DISTRIBUTION:")
micro = len([w for w in wins if w < 1])
small = len([w for w in wins if 1 <= w < 5])
good = len([w for w in wins if 5 <= w < 15])
excellent = len([w for w in wins if w >= 15])
total = len(wins)
print(f" Micro (<$1): {micro} trades ({micro/total*100:.0f}%)")
print(f" Small ($1-5): {small} trades ({small/total*100:.0f}%)")
print(f" Good ($5-15): {good} trades ({good/total*100:.0f}%)")
print(f" Excellent (>$15): {excellent} trades ({excellent/total*100:.0f}%)")
print()
print("=" * 60)