Commit Graph
6 Commits
Author SHA1 Message Date
ZhijuCen 061e879638 feat(parse_tester_report): add 'windows' subcommand for time-window outlier analysis
Split backtest into N equal time slices (left-closed right-open) and
compute the 7 core metrics per window: Profit, EP, PF, RF, Balance DD
Rel%, Trades, Sharpe. Each window gets an outlier flag based on per-
metric z-score (|z|>=2 = notable, |z|>=5 = extreme). N=1 runs a full-
period cross-check vs the HTML report.

Key changes:
- Add compute_windows / compute_window_metrics / print_windows /
  windows_comparison functions, CLI subcommand 'windows'
- pair_trades now exports gross_pnl/entry_costs for MT5 GP/GL split
- compute_gross_profit_loss: MT5 accounting (entry costs always to GL)
- _balance_dd_relative: max relative DD (STAT_BALANCE_DDREL_PERCENT)
- _sharpe_ratio: textbook (AHPR-1)/std_HPR formula, 365-day year
- Help text with examples for both --help and windows --help
- verify_sl_tp_formulas.py: localize all output labels to English
- AGENTS.md / SKILL.md: document windows subcommand conventions

Docs: 5 of 7 metrics exact for N=1 (Profit, EP, PF, Trades exact;
RF/BalDD% are approximations due to balance-only reconstruction;
Sharpe uses textbook formula diverging from MT5's 22.92)
2026-07-04 01:18:33 +08:00
ZhijuCen aa0909764f feat(parse_tester_report): replace gap_days_to_end with idle_time (HH:MM:SS)
- 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
2026-06-29 12:20:16 +08:00
ZhijuCen 99fa0477ab fix: parse backtest end date from period string with trailing paren
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 ")".
2026-06-25 03:12:48 +08:00
ZhijuCen e0d7c3ca54 fix: use backtest end date instead of datetime.now() for gap calculation
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.
2026-06-25 03:10:32 +08:00
ZhijuCen 8482f7a8a1 feat: sync SKILL.md and parse_tester_report.py with installed version
SKILL.md:
- §2: add "How to look up any trading function" guidance
- §3: add ADX indicator example + "How to look up any indicator" guidance
- §5: strengthen OrderCalcProfit verification (step 3), add minLot risk
  warning (step 6)
- §8: add §11 Market Regime Filtering (ADX + time-based, generic)
- §8: add §12 Deal-Level Debugging Methodology (pairs deals, risk check,
  re-entry detection, monthly breakdown)

parse_tester_report.py:
- Add pair_trades(): pair entry/exit deals into complete trades
- Add analyze_report(): SL/TP hits, win/loss ratio, consecutive losses,
  re-entry detection, monthly breakdown, volume patterns
- Add --analyze CLI flag
- Use datetime.now() instead of hardcoded date for gap calculation

All content is framework-agnostic (no hermes/openclaw/claude/codex refs).
2026-06-25 02:51:22 +08:00
ZhijuCen 17f5a5f607 feat: EA report parser and performance evaluation guide
- Add scripts/parse_tester_report.py: parses MT5 Strategy Tester HTML
  reports (UTF-16LE). Extracts settings, EA parameters, 44 P&L metrics,
  orders (192), deals (193), stop-out detection. Supports --json output.
- Add Report Analysis subsection to SKILL.md Section 6: 10 evaluation
  dimensions (data quality, profitability, drawdown, trade distribution,
  consecutive losses, holding time, MFE/MAE, stop-out, bias, commission).
2026-06-24 13:57:49 +08:00