TradeLab-MCP
TradeLab-MCP
量化研究 MCP 服务器。AI 定义策略。MetaTrader 5 的 Strategy Tester 执行回测。
IA (Codex / GPT / Grok / Gemini / Claude)
│ MCP
▼
Trading Research MCP
│
▼
terminal64.exe → Strategy Tester oficial → runs/<run_id>/Fork 自 PHUICMT/mcp-mt5(MIT)。不在 Python 中重新实现 tester。
原理
MT5 是订单、成交、tick、点差、SL/TP、保证金、佣金和 P&L 的权威。
Python 只负责组织实验(run_id、manifest、hashes、parser、派生统计信息)。
每次回测都会生成一个唯一标识符。不会通过“最新文件”来检索任何内容。
runs/20260817_073412_a8f231/
tester.ini
strategy.mq5
strategy.ex5
report.htm
tester.log
trades.csv
metrics.json
manifest.jsonRelated MCP server: OpenFinClaw CLI
MCP 工具(V1)
工具 | 功能 |
| MT5、MetaEditor、终端、数据目录、Experts、Tester、build |
| 编译 |
| 官方 Tester → |
| 同一策略、多个资产,顺序执行 |
| 通过 |
| 该 |
| 比较不同 run 之间的指标 diff |
| IS/OOS 窗口,每个窗口都是一次官方回测 |
| 编译 + 简短 tester(可配置符号/周期/模型/数据) |
安装
Windows + MetaTrader 5 + Python 3.10+。
cd C:\Users\caioa\TradeLab-MCP
python -m pip install -e ".[dev]"MCP 客户端:
{
"mcpServers": {
"tradelab": {
"command": "tradelab-mcp",
"env": {
"MT5_INSTALL": "C:\\Program Files\\MetaTrader 5",
"TRADE_LAB_ROOT": "C:\\Users\\caioa\\TradeLab-MCP\\research"
}
}
}
}变量:MT5_INSTALL、MT5_DATA、MT5_TERMINAL_HASH、TRADE_LAB_ROOT。
示例
Compile este EA e faça um backtest de PETR4 D1,
entre 2015 e 2025, usando real ticks.智能体调用 run_backtest(strategy="experts/RSI2.mq5", symbol="PETR4", timeframe="D1", from_date="2015.01.01", to_date="2025.08.01", model=4) 并收到:
{
"run_id": "20260817_073412_a8f231",
"status": "completed",
"symbol": "PETR4",
"period": "D1",
"model": "real_ticks",
"metrics": {
"total_trades": 134,
"net_profit": 18342.21,
"profit_factor": 1.48
}
}get_run("20260817_073412_a8f231") 返回的正是该实验。
EA 在 MT5 中的存放位置
所有自动测试 EA 都发布在:
<MQL5>\Experts\TradeLab MCP\在这台 PC 上解析为:
C:\Users\caioa\AppData\Roaming\MetaQuotes\Terminal\D0E8209F77C8CF37AD8BF550E51FF075\MQL5\Experts\TradeLab MCP
在 Strategy Tester 中,该 expert 显示为 TradeLab MCP\RSI2。该文件夹始终相对于活动终端(layout.experts_dir),而不是固定的 hash。
git 中的源代码仍在 experts/。MCP 会将源代码 + .ex5 + 本地 includes 复制到终端文件夹。
实验室的 EA 基类(CTrade、ArraySetAsSeries、一个仓位)尚未标准化——稍后再慢慢加入。
验收 EA
experts/RSI2.mq5
RSI(2)
如果 RSI < 10 则买入
如果 RSI > 70 则退出
一个仓位
无优化
第 1 号验收测试是:在手动 Strategy Tester 和通过 MCP 使用相同的 EA / 资产 / 日期 / 输入 / 资金 / model 时,必须产生相同的指标和相同的交易。
测试
pytest集成测试(Windows + 真实 MT5):
$env:TRADE_LAB_INTEGRATION = "1"
$env:TRADE_LAB_SYMBOL = "EURUSD"
pytest tests/test_integration_mt5.py -v优先级
可复现性 > 可靠性 > 简单性 > 速度 > 功能
V1 是顺序执行的(数据目录中的锁 mt5.lock)。没有并行 Python 回测器。没有将 .opt 解析器作为官方来源。
This server cannot be installed
Maintenance
Resources
Unclaimed servers have limited discoverability.
Looking for Admin?
If you are the server author, to access and configure the admin panel.
Related MCP Servers
- Alicense-qualityDmaintenanceMCP server that provides AI agents with financial tools including real-time quotes, backtesting, technical analysis, and multi-exchange data via a simple CLI interface.1MIT
- Flicense-qualityDmaintenanceEnables quant research, strategy generation, backtesting, and paper trading from natural language prompts, integrating with AI agents via an MCP server.61
- AlicenseAqualityAmaintenanceAn MCP server exposing a registry of paper-backed quantitative trading methods plus a deterministic, no-LLM decision helper for reproducible trading research.13MIT

backtest360-mcpofficial
AlicenseAqualityDmaintenanceMCP server that exposes the Backtest360 backtesting engine API as tools, enabling AI agents to conversationally discover indicators, build and validate strategies, run backtests, and read results.14MIT
Related MCP Connectors
MCP server exposing the Backtest360 engine API as tools for AI agents.
MCP server for Gainium — manage trading bots, deals, and balances via AI assistants
Build, backtest, and deploy quantitative trading strategies from your AI agent.
Latest Blog Posts
- Who's Calling? MCP Hosts Are an Identity Blind Spot (And the Spec Knows It)By Om-Shree-0709 on .mcpAgent IdentityOAuth 2.1
- Your AI Chatbot Just Exposed Your CEO's Salary to an InternBy Om-Shree-0709 on .Agent IdentityMCP SecurityOAuth Delegation
- Why MCP Servers Need Execution Sandboxing (And Why Your Current Stack Isn't Enough)By Om-Shree-0709 on .Agentic AiPrompt InjectionWebAssembly
MCP directory API
We provide all the information about MCP servers via our MCP API.
curl -X GET 'https://glama.ai/api/mcp/v1/servers/CaioAllgayer/TradeLab-MCP'
If you have feedback or need assistance with the MCP directory API, please join our Discord server