MT5 binaries (MetaEditor64.exe, metatester64.exe, terminal64.exe) are all
GUI applications with no command-line data export capability.
Removed:
- export_ohlc - Cannot read proprietary .hst binary format
- export_ticks - Cannot read proprietary .ticks binary format
- list_available_data - Only scanned directories, didn't export
Total tools: 46 → 43
Alternative for data export:
1. Use MT5 History Center GUI → Export
2. Create MQL5 script using CopyRates()/CopyTicks() → FileWrite
3. Run the MQL5 script inside MT5 terminal
**New Tools:**
- export_ohlc: Export OHLC bar data from MT5 history to CSV/JSON
- export_ticks: Export tick data from MT5 tick database to CSV/JSON
- list_available_data: List available OHLC and tick data in MT5
**Implementation:**
- definitions/data.rs: Tool schemas for data export
- handlers/data.rs: Handlers that scan MT5 directories:
- history/*.hst files (OHLC)
- Tester/cache/* (cached data)
- Bases/* (tick data)
- Provides guidance on how to export since MT5 uses proprietary binary formats
- Includes MQL5 script template for programmatic export
**Note:** MT5 uses proprietary .hst and .ticks binary formats.
Direct export requires MQL5 script using CopyRates()/CopyTicks().
**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
**Report Database (src/storage/):**
- New SQLite-based report registry for tracking backtest history
- ReportDb with methods: init, list, count, annotate, list_purgeable, delete_entry
- Charts relocation to temp directory with automatic cleanup
- Set file snapshotting alongside extracted data
- Database registration integrated into backtest pipeline
**compile_ea Tool Improvements:**
- Support both 'expert' (EA name) and 'expert_path' (full path) parameters
- Auto-discovery: searches MT5 Experts dir and current directory for .mq5 files
- Better error messages when EA not found
- Added files_synced and warning_list to response
- Updated tool definition to reflect new parameters
**Pipeline Updates:**
- Backtest pipeline now registers results in database after completion
- Equity charts moved to OS temp dir with unique report ID
- HTML reports cleaned up after extraction
- Set file snapshots preserved for reproducibility
**Dependencies:**
- Added rusqlite for SQLite database support
- Add fallback error message with log excerpt when .ex5 missing but no errors parsed
- Include raw log excerpt when few errors detected for better debugging
- Ensures users always see actionable error info when compilation fails
- Handle protocolVersion from client initialize request params
- Negotiate compatible version (fallback to 2024-11-05 for 2025.x requests)
- Fix 'unsupported protocol version' error when client sends empty version
- Replace hello_world demo tool with production-ready healthcheck tool
- Auto-detect OS platform, architecture, and version (macOS/Linux)
- Validate configuration: config file, Wine/MT5 paths, directories
- Add detailed mode with Rust version, paths, and environment variables
- Update workflow documentation with healthcheck as example
- Port full Python MT5-Quant MCP server to Rust
- Implement all MCP tools: verify_setup, list_symbols, list_experts, run_backtest, compile_ea
- Add configuration management with YAML parsing
- Create optimized release binary
- Update MCP configuration to use Rust binary
- Remove Python dependency, single binary deployment
Performance improvements:
- 10x faster startup time
- Memory efficient with zero-cost abstractions
- Thread-safe async/await implementation
- No Python interpreter overhead
All functionality tested and working correctly.
list_symbols:
- Reads terminal.ini to detect active broker server (LastScanServer)
- Lists all servers in Bases/ with their available symbols
- Warns if OptMode=-1 needs reset
- Accepts optional server filter
list_experts:
- Recursively scans MQL5/Experts/ including sub-folders
- Returns name, subfolder, and ready-to-use run_backtest_expert value
- Accepts optional name filter (case-insensitive)
backtest_pipeline.sh:
- Fail fast with clear actionable message when MT5 is running and
--kill-existing not set (instead of silently timing out after 900s)
- Updated help text for --kill-existing flag
_check_symbol fix:
- Was reading terminal_dir/history/ (does not exist)
- Now reads Bases/<active_server>/history/ from terminal.ini
- When symbol missing: shows which other servers have it
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Default behavior change:
- ShutdownTerminal=0: MT5 stays open after backtest completes
- Report detected via file watching (poll every 5s) instead of
waiting for process exit — decouples completion from shutdown
- Running MT5 instance: launch a second terminal64.exe with /config:
(Windows single-instance passthrough delivers config to running
window without killing it, then second instance exits)
New flags (script + MCP tool):
- --shutdown / shutdown:true — ShutdownTerminal=1, synchronous wait,
kills running instance first (CI/headless use case)
- --kill-existing / kill_existing:true — explicit opt-in to SIGTERM
existing MT5 before launch (fallback if passthrough fails)
Progress reporting during file-watch poll (elapsed counter printed
every 5s); timeout error now includes actionable hints.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>