# MT5 Helper Utilities This directory contains helper scripts for managing MT5 trading and extracting data safely. ## Scripts ### view-report.sh View MT5 HTML trading reports without browser (prevents VM crash). ```bash ./view-report.sh /path/to/ReportHistory-XXXX.html ``` ### parse-deals.py Parse MT5 binary deal files to extract trading data. ```bash python3 parse-deals.py ``` Output: Account summary with P&L, trade counts, win/loss stats. ### export-history.sh Guide for safely exporting trade history from MT5. ```bash ./export-history.sh ``` ## Why These Are Needed MT5 in Wine/VM crashes when generating reports because: 1. MT5 tries to open HTML in default browser 2. No browser installed in Wine environment 3. Browser launch fails → VM crash These scripts work around that limitation. ## Report File Locations ### Binary Data (Internal) ``` ~/mt5-docker/config/.wine/drive_c/Program Files/MetaTrader 5/Bases/ ├── MetaQuotes-Demo/trades/104125640/deals_2026.03.dat ├── MetaQuotes-Demo/trades/103477358/deals_2026.02.dat └── ... ``` ### HTML Reports (User Generated) ``` ~/mt5-docker/config/.wine/drive_c/users/abc/Desktop/ReportHistory-XXXX.html ``` ### Text Logs ``` ~/mt5-docker/config/.wine/drive_c/Program Files/MetaTrader 5/MQL5/Logs/YYYYMMDD.log ~/mt5-docker/config/.wine/drive_c/Program Files/MetaTrader 5/logs/YYYYMMDD.log ``` ## show-latest-report.sh Automatically finds and displays the latest MT5 trading report. ```bash ./show-latest-report.sh # Show latest report ./show-latest-report.sh --save # Save to text file ``` **Features:** - Automatically finds the most recent `ReportHistory-*.html` file - Displays formatted summary with colors - Shows account info, P&L, trade stats, and performance assessment - No browser needed (prevents VM crash) ## parse-report.py Python parser for MT5 HTML reports (used by show-latest-report.sh). ```bash python3 parse-report.py # Auto-find latest python3 parse-report.py /path/to/file.html # Parse specific file ``` **Output includes:** - Account name and company - Net profit, gross profit/loss - Profit factor - Total trades, win/loss count - Win rate percentage - Largest win/loss - Balance and return calculation - Performance assessment