New script skills/mql5/scripts/parse_optimizer_report.py reads the
SpreadsheetML export from MT5 Strategy Tester optimization (one row per
parameter pass, plus a <DocumentProperties> environment card).
Companion to parse_tester_report.py. --analyze adds:
- Strategy environment card (EA / Symbol / Period / date range from
Title; deposit / leverage / server / MT5 build from DocumentProperties)
- Orthogonality check (actual passes vs expected cartesian product)
- Parameter effect ranking (effect_ratio = spread / global std) and
dead-parameter detection (per-group mean range < 1% of max)
- Dead boolean parameter detection (bit-for-bit identical true/false
groups across all key metrics)
- Duplicate metric vector counting (>30% usually means a dead param)
- Top-5 best passes by Profit / Profit Factor / Recovery Factor / Custom
- Trade count distribution with daily rate and correlations vs profit
and drawdown (overtrading / undertrading detection)
SKILL.md adds a new 'Optimization Report Analysis' subsection under
the Backtesting chapter covering environment card, orthogonality,
dead parameter / boolean parameter / duplicate detection, multi-
criteria best-pass selection, parameter effect ranking, trade count
diagnostics, and a reporting template.
Validated against jobs/246753/ReportOptimizer-*.xml (OneShotGold,
XAUUSD H4, 432 passes): correctly identifies InpUseNewsFilter as a
dead boolean parameter (true/false identical on Profit/PF/RF/Trades,
189 of 432 metric-vector duplicate groups), reports the trade/profit
overtrading signal (corr -0.56), and ranks best passes.
Adds pandas dependency (used for groupby/aggregate/corr on the pass
table; the script falls back to dict-list output if needed).
- Remove gap_days_to_end and last_trade_close from analyze_report output
- Add idle_time: total backtest duration minus all position holding times
(includes flat time before first trade and after last trade)
- Add format_duration() helper for timedelta -> HH:MM:SS formatting
- Parse both start/end dates from period string for accurate calculation
- Update print_report() to display idle_time in Holding Times section
- main() now always computes analyze data for text report
- Update AGENTS.md: add scripts docs, jobs/resources dirs, verification method
Period format is "H4 (2024.12.25 - 2026.06.22)" — use regex to extract
the date before the closing paren instead of split+strip which fails on
the trailing ")".
Parse end date from Settings.period ("2024.01.01 - 2025.06.22") and use
it as reference for gap_days. Falls back to datetime.now() only if period
cannot be parsed. Rename output key gap_days_to_now → gap_days_to_end.
Resolution order for MQL5_DIR:
1. MQL5_DIR env var (explicit override)
2. Walk up cwd looking for a dir with Experts/ + Indicators/ children
3. MT5_BASE/MQL5 (Linux/Wine default)
When detected from cwd, also infers MT5_BASE as the parent directory.
- MQL5_DIR override via MQL5_DIR env var (Windows 10+ stores MQL5 in
%APPDATA%, not under the install dir)
- compile/check now pass absolute paths to /compile:"path" instead of
computing relative_to(MT5_BASE) which would fail when MQL5_DIR is
separate