- fix: inactivity watchdog now waits 30s for HTML report then kills
terminal64.exe unconditionally — ShutdownTerminal=1 does not cause
MT5 to exit on Wine/macOS; relying on natural exit caused all runs
to fall back to journal extraction
- fix: tester agent log deduplication — each deal is written twice in
the log; use HashSet to skip already-seen deal numbers
- fix: position tracker for entry direction inference — infer "in"/"out"
from per-symbol signed lot accumulation instead of guessing
- fix: is_closed_trade() no longer gates on profit!=0.0 — journal deals
have profit=0.0 legitimately; the old gate hid all 140 deals from
list_deals
- fix: log file selection priority — prefer Agent-127.0.0.1 over
Agent-0.0.0.0 (startup-only log), tiebreak by file size
- feat: launch_backtest default shutdown=true; inactivity_kill_secs
default 120s exposed as tool parameter
- feat: report DB stores deals in SQLite; analytics resolve by
report_id / report_dir / latest
Verified: 1-month DPS21/XAUUSD.cent/M5 backtest produces full HTML
report with all metrics (win_rate=70%, profit_factor=0.77, sharpe=-3.61,
max_dd=6.93%) and all 17 analytics tools returning real data.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
**Granular Analytics Tools (8 new tools):**
- analyze_monthly_pnl - Monthly profit/loss breakdown
- analyze_drawdown_events - Drawdown events from balance curve
- analyze_top_losses - Top N worst losses with grid depth
- analyze_loss_sequences - Consecutive loss streaks analysis
- analyze_position_pairs - Entry/exit position pairs
- analyze_direction_bias - Long vs Short performance stats
- analyze_streaks - Win/loss streaks with dates
- analyze_concurrent_peak - Peak concurrent open positions
**Updated analyze_report:**
- Now supports selective analytics via 'analytics' array parameter
- Runs all analytics by default (backward compatible)
- Optional top_losses_limit parameter
- Returns list of analytics that were run
**Changes:**
- analytics/analyze.rs: Made all analysis methods public
- tools/definitions.rs: Added 8 new tool definitions + updated analyze_report schema
- tools/handlers/mod.rs: Added dispatch for new tools
- tools/handlers/analysis.rs: Added helper load_report_data() + 8 granular handlers + selective analyze_report logic