Labsco
TradeSystemsNique logo

mt5-mcp-by-leo

โ˜… 1

from TradeSystemsNique

Complete MCP server for MT5: Through the MCP protocol, it allows [Trades, Orders, History, Graphic Objects, Terminal Logs, Compilation, etc.]

๐Ÿ”ฅ๐Ÿ”ฅ๐Ÿ”ฅโœ“ VerifiedFreeAdvanced setup

Universal MCP Server for MetaTrader 5 Trading & Data Operations


Overview

FullMt5McpByLeo is a complete, production-ready MCP server that enables Claude and other AI assistants to control MetaTrader 5 directly. Execute trades, retrieve market data, manage charts, analyze trading history, and automate MT5 operations through natural language.


Main Features (General)

  • Fast execution; the MCP server is written in C++ using simdjson and MQL5 uses JsonParserByLeo (fast MQL5 JsonParser), ultra-optimized code for maximum speed. The average response time is around 10ms (from when Claude calls a function until its response; note that this may depend on the size of the request... on average it's 10ms).
  • Unlike other MCPs for MT5, this MCP has two parts, one in MQL5 and the other in C++, giving access to the full MQL5 API and not limited to the mt5 package for Python, which lacks functions for handling charts, etc.

Main Features (MCP Functions)

Trade Operations

Execute and manage trading positions and orders:

  • Open Positions: Execute market trades (buy/sell) with immediate or pending orders
  • Position Management: Modify stops/profits, close positions (full or partial)
  • Order Management: Create, modify, and cancel pending limit/stop orders
  • Trading History: Query completed deals with profit/loss analysis

Market Data & Symbols

Access real-time and historical data:

  • OHLC Data: Retrieve candlestick data (open, high, low, close, volume, spread, etc..)
  • Tick data: Retrieve Tick data (last, ask, bid, flags, etc..)
  • Symbol Information: Get symbol properties (digits, spreads, swaps, volumes, etc.. full SYMBOL_INFO_*)
  • Market Watch: Manage symbol selection and availability

Indicators

  • Indicator Manager: Get parameters, Add indicadors (ALL, Custom, MA, ETC..), Remove, Get Buffers, etc..

Graphic Objects

Create and modify chart visualizations:

  • Draw Objects: Create trend lines, rectangles, text labels, arrows
  • Object Properties: Modify colors, styles, prices, text, full ENUM_OBJECT_PROPERTY_*
  • Chart Annotations: Add visual markers and indicators to charts

Chart Management

Control chart windows and redraw operations:

  • Chart Operations: Open, close, list active charts
  • Chart Properties: Read chart dimensions, colors, price ranges
  • Visual Updates: Force chart redraw for real-time updates
  • Indicators: Add\Delete\GetName\GetTotal of indicator of any chart\subwin
  • Navigate: Navigate chart

Code & Terminal

Compile and execute Expert Advisors:

  • Compilation: Compile MQL5 source to EX5 bytecode
  • Backtesting and Optimization: Run historical tests with multiple tick modeling\leverage\opt criterian\opt mode\forward\visual mode.. etc and get full report, deals, balance\equity curve.
  • EA Execution: Run Expert Advisors in real-time
  • Logging: Retrieve EA logs for debugging and monitoring
  • Terminal and Account: Obtaing terminal and acount info_* (integer, string, double)

Note: Python version package mt5_mcp_by_leo is deprecated. now replace by C++ exe server. Note: Unlike other MCPs that use .ini files to launch backtests, this MCP doesn't need that because it controls the entire MT5 tester from the same EA, without .ini files, without wasted terminals. In addition, the code compilation is more complete since its AI can choose whether or not to optimize the code, instructions, etc.


Repository Structure

FullMt5McpByLeo/
โ”œโ”€โ”€ Src/                              # MQL5 Backend Functions
โ”‚    ....
โ”œโ”€โ”€ mt5_mcp_by_leo/                   # Json tools definition
โ”‚    ....

Documentation


Contact


Copyright ยฉ 2026 Niquel Mendoza (nique_372).
TSN Trading Systems ecosystem.