Commit Graph

13 Commits

Author SHA1 Message Date
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 63a8d67fb0 fix: prioritize MetaEditor64.exe in MT5 discovery, exact case-sensitive match
- _find_mt5_in_program_files: score dirs by executable presence,
  MetaEditor64.exe=2 > metaeditor64.exe=1 > terminal*=0
- _find_editor: drop rglob, check exact filenames only (case-sensitive)
2026-06-24 17:31:09 +08:00
ZhijuCen f0957c4cd9 feat: scan Program Files subdirs for MT5 installation
MT5_BASE resolution order:
  1. MT5_BASE env var
  2. MQL5_DIR detected from cwd → MT5_BASE = parent
  3. Scan Program Files + Program Files (x86) for terminal64.exe/metaeditor64.exe
  4. Hardcoded Wine fallback
2026-06-24 17:28:56 +08:00
ZhijuCen 7cb13ccc0d feat: auto-detect MQL5_DIR by walking up from cwd
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.
2026-06-24 17:26:15 +08:00
ZhijuCen 9da69ee908 fix: make MQL5_DIR configurable, use absolute paths for MetaEditor
- 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
2026-06-24 17:22:47 +08:00
ZhijuCen 44f32f601f fix: make MT5_BASE configurable via environment variable
MT5_BASE env var overrides the default Wine path, supporting non-default
installations and other platforms.
2026-06-24 17:20:19 +08:00
ZhijuCen dd90d42537 fix: correct backtesting limitations and simplify mql5_helper
SKILL.md Section 6:
- Add GUI-only declaration for Strategy Tester
- Document metatester64.exe (remote agent mgmt only) and terminal64.exe (no CLI)
- Add CLI Automation table: compile , syntax check , backtest , optimization 
- Document MetaEditor CLI syntax: /compile:"path" /log and /log /s
- Add Parameter Optimization section with [start, stop, step] format
- Revise Backtesting Workflow with CLI step
- Replace "Automated Backtesting Loop" with accurate "EA Development Cycle"

mql5_helper.py:
- Simplify detect_type: path-only detection (remove content-based reading)
- Fix compile arg format: /compile:"relpath" /log (was wrong format)
- Add check subcommand: syntax-only verification via /s flag
- Extract _find_editor() shared by compile and check
- Remove unused 'import os'
- Simplify main() with dict dispatch
2026-06-24 16:15:45 +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
ZhijuCen 8749cadfbb fix: use AccountInfoString for ACCOUNT_CURRENCY in SKILL.md 2026-06-24 03:57:41 +08:00
ZhijuCen cb0f520623 feat: SL/TP risk formulas, project docs, symbol specs
SKILL.md Section 5 rewritten with PointValue-based formulas:
- Direction A: SL points → SL price
- Direction B: Risk% + lots → SL price (with currency conversion)
- Direction C: SL price + risk% → lot size
- FindFXRate helper for profit_currency ≠ account_currency
- OrderCalcProfit verification pattern

Section 8 expanded with 6 SL/TP pitfalls (PointValue vs TICK_VALUE,
TickSize ≠ Point, currency conversion, NormalizeDouble rounding,
lot step quantization, STOPS_LEVEL check).

Section 9 EA skeleton now includes inline PointValue, FindFXRate,
CalcSLFromRisk, CalcLotsFromSL functions.

New files:
- LICENSE (MIT)
- README.md
- docs-dev/symbol-spec.md (symbol spec workflow)
- skills/mql5/references/symbol-spec/specs-{XAUUSD,USDJPY}.csv
- skills/mql5/scripts/verify_sl_tp_formulas.py (Python verification)

Updated: pyproject.toml, AGENTS.md, .gitignore, docs-dev/skill-design.md
2026-06-24 03:32:28 +08:00
ZhijuCen d17f68e979 Initial Commit. 2026-06-23 21:47:51 +08:00