Releases: Boschi404/mt5-mcp-server
Release list
v2.1 — Sharpe/Sortino/Calmar + Validation
v2.1 — Risk Metrics Done Right
New: get_risk_metrics tool (37th)
- Sharpe Ratio — properly annualized using trading frequency, risk-free rate subtracted
- Sortino Ratio — downside-only volatility, penalizes negative returns
- Calmar Ratio — annualized return / max drawdown
Validation Checks
Every metric comes with sanity checks:
- Sharpe > 10? → WARNING: suspiciously high
- Sortino >> Sharpe? → CHECK: positive skew verified
- Profit Factor > 100? → WARNING: likely look-ahead bias
- Win Rate > 95%? → WARNING: survivorship bias
- Output: GOOD / SUSPICIOUS / UNRELIABLE
Pipeline Integration
- Monte Carlo phase now computes all risk metrics
- Report shows Sharpe/Sortino/Calmar with colored indicators
- Validation warnings displayed in report
v2.0.1 — Pipeline phases ALL REAL, no placeholders
v2.0.1 — Every Phase Implemented
All 9 pipeline phases now execute REAL computations:
- ✅ Create — MQL5 code generation
- ✅ Compile — MetaEditor compilation
- ✅ Screen — Multi-symbol 1M OHLC backtest
- ✅ Correlate — Correlation matrix + diversification score
- ✅ Optimize — Tick-data genetic optimization
- ✅ Monte Carlo — 1000 sims, skip 10% random trades
- ✅ Kelly — Position sizing from real trade data
- ✅ Robustness — 100 random 6-month windows
- ✅ Report — Full HTML report with all metrics
Zero placeholders. Every phase writes results to its folder.
v2.0 — AUTONOMOUS PIPELINE (36 tools)
🚀 v2.0 — Full Autonomous Strategy Pipeline
🆕 The Pipeline (2 new tools)
build_strategy_code— Generate complete MQL5 EA from natural language descriptionrun_autonomous_pipeline— One command to run ALL phases:
Pipeline Phases
- Create — Generate MQL5 code from description with all parameters
- Compile — Compile to .ex5 + error check
- Screen — Test on 15+ major symbols with 1M OHLC
- Correlate — Find uncorrelated candidates for portfolio
- Optimize — Tick-data optimization with fixed risk
- Monte Carlo — 1000 simulations, skip 10% random trades
- Kelly — Position sizing, max 15% DD
- Robustness — 100x 6-month random start backtests
- Report — Final comprehensive PDF/HTML report
Report Includes
- Strategy explanation + timeframe + assets
- Correlation matrix between assets
- Monte Carlo stats (probabilities, confidence intervals)
- Z-Score, Sharpe, Sortino, LR Correlation
- Max DD, Total Profit %, Time-normalized returns
- Trade count + frequency, Win rate, Avg RR
- Max/Avg Win & Loss, Max Win/Loss Streaks
Folder Structure
pipelines/StrategyName_20260101/
├── 01_create/ MQL5 code + parameters
├── 02_compile/ Compilation results
├── 03_screen/ Multi-symbol screening
├── 04_correlate/ Correlation analysis
├── 05_optimize/ Tick-data optimization
├── 06_montecarlo/ 1000 simulations
├── 07_kelly/ Position sizing
├── 08_robustness/ 100x 6-month tests
└── 09_report/ Final PDF report
Example
LLM → build_strategy_code('Channel breakout on M15 with EMA50 H4, SL 700pts, TP 3000pts')
LLM → run_autonomous_pipeline('GoldBreakout', strategy_description='...')
→ 20 minutes later: complete strategy report on your Desktop
v1.4 — Batch Testing + Portfolio Diversification Analyzer (34 tools)
🚀 v1.4 — Portfolio Intelligence (34 tools)
🆕 Batch Testing
run_multi_backtest— Test EA on multiple symbols in one call, get aggregate statsbacktest_to_returns— Convert results to returns series for portfolio analysis
🆕 Portfolio Diversification (0-100 score)
analyze_portfolio_diversification— Comprehensive scoring with:- Correlation matrix + pair analysis
- Diversification score (0-100) with verdict
- Volatility reduction benefit %
- Concentration risk detection
- Asset class coverage analysis
- Specific recommendations (which pairs to remove)
🆕 Live Portfolio Health
get_portfolio_health— Real-time portfolio analysis:- Total P&L, exposure, margin usage
- Win/loss ratio
- Concentration risk (single symbol dominance)
- Health verdict: HEALTHY / CONCENTRATED / DRAWING DOWN
Scoring Scale
- 80-100: 🏆 EXCELLENT — Highly diversified
- 60-79: ✅ GOOD — Well diversified
- 40-59:
⚠️ MODERATE — Some concentration risk - 20-39: 🔴 POOR — High correlation
- 0-19: ❌ NOT DIVERSIFIED — Single asset portfolio
Full Pipeline Now
Write EA → Compile → Multi-Backtest → Returns → Diversification Score → Kelly Sizing → Live Trade → Monitor Health
v1.3 — Live Trading + Portfolio + Data (30 tools)
🚀 v1.3 — 30-Tool Complete MT5 Suite
🔴 LIVE TRADING (NEW — 6 tools)
place_order— Market & pending orders (buy/sell/limit/stop)get_positions— Open positions with real-time P&Lclose_position— Close by ticket or close allmodify_position— Modify SL/TP on open positionsget_account— Balance, equity, margin, leverageget_order_history— Historical deals with P&L
📊 PORTFOLIO (NEW — 3 tools)
calc_correlation— Correlation matrix, diversification scorecalc_efficient_frontier— Markowitz optimal weights, max Sharpecalc_risk_allocation— Equal risk, Kelly, inverse-DD allocation
📡 DATA (NEW — 5 tools)
get_bars— OHLC bar data for any symbol/timeframeget_ticks— Raw tick data with spread statslist_symbols— All available trading symbolsget_latest_price— Real-time bid/ask for multiple symbolsget_symbol_info— Spread, swap, margin, tick value
📈 Previously (v1.0-v1.2)
Backtest, Optimization, EA dev, Compilation, Monte Carlo, Walk-Forward, Kelly, CSV export
Full Pipeline
LLM can now: Write EA → Compile → Backtest → Optimize → Monte Carlo → Walk-Forward → Kelly sizing → Live Trade → Monitor positions — all via MCP
v1.2 — Advanced Analytics Suite
🚀 v1.2 — 17-tool MCP Server with Advanced Analytics
New Tools (6 added since v1.1)
Monte Carlo:
run_monte_carlo— 1000-simulation robustness test with P5/P95 confidence intervalsrun_walk_forward— Rolling window OOS validation to detect overfitting
Position Sizing:
calc_position_size— Kelly Criterion, Optimal F, Risk of Ruin calculator
Data & Analysis:
get_symbol_info— Full symbol specs: spread, swap, margin, tick valueexport_trades— Export backtest results to CSVget_trade_stats— Expectancy, Z-score, Sharpe, streaks
Full 17-Tool Suite
1-5: Backtest & Optimization
6-9: EA Development & Compilation
10-11: Results & Parameters
12-17: NEW — Advanced Analytics
Install
git clone https://github.com/Boschi404/mt5-mcp-server.git
pip install fastmcp MetaTrader5 numpyv1.1 — Full MT5 Control Suite
🚀 v1.1 — 11-tool MCP Server
New Tools (6 added since v1.0)
Optimization:
run_mt5_optimization— Genetic & complete parameter sweepsget_optimization_results— Parse .opt files with best passes
EA Development:
write_expert— Write/update .mq5 source code with auto-compilationcompile_expert_file— Compile .mq5 → .ex5 via MetaEditorread_expert_code— Read full MQL5 sourceget_ea_parameters— Extract input params, types, defaults
Full Workflow Now Possible
- Write EA code → compile → optimize → analyze results — all via LLM
- Perfect for: backtesting, EA development, portfolio optimization
- Works with Hermes Agent, Claude Desktop, and any MCP client
Install
git clone https://github.com/Boschi404/mt5-mcp-server.git
pip install fastmcp MetaTrader5
hermes mcp add mt5-backtest --command python --args server.py --timeout 600