convez.ai
MCP ServerFinanceiroAvançado
emerzon

MT Data MCP – Toolkit de Pesquisa e Automação para MetaTrader 5

emerzon/mt-data-mcp

Pesquisa e automação MT5 via CLI, MCP e Web API com ML e análise quantitativa

Ver no GitHub
BomPluginScore · de 0 a 100

Servidor MCP que transforma um terminal MetaTrader 5 em ferramentas CLI, MCP e API Web local para análise de dados de mercado, previsões, detecção de regimes, processamento de sinais e backtesting. Inclui 100+ indicadores técnicos, detecção de padrões, análise de volatilidade e suporte a trading automatizado com controles de segurança.

Instalação

$npx convez-ai emerzon/mt-data-mcp

1 comando no terminal: detecta o formato do repositório (marketplace ou plugin avulso) e instala via Claude Code. Requer Node 18+ e o Claude Code instalado.

Métricas

Estrelas
22
Forks
10
Acompanhando
0
Saúde
42%
Último commit
há 1 semana
Versão
—
Issues abertas
0
Contribuidores
2

Casos de uso

  • Backtesting de estratégias de trading sistemático
  • Análise e previsão de séries temporais de mercado
  • Scanning automático de símbolos por spread, volume e indicadores técnicos
  • Detecção de regimes de mercado (tendência, range, crise)
  • Integração de dados MT5 com assistentes IA via MCP
  • Cálculo de probabilidades de barreiras (take-profit/stop-loss) via simulação

Veredito

Ferramenta robusta para traders sistemáticos e pesquisadores quantitativos que precisam de acesso programático a dados MT5 com análise técnica profunda. Requer Windows, Python 3.14 e compreensão sólida de trading; inclui proteções contra execução acidental em contas reais, mas exige disciplina na separação de demo/live.

README

A tradução para o português deste README ainda está na fila.

mtdata

mtdata is a Windows-first research and automation toolkit for MetaTrader 5 (MT5). It turns a running MT5 terminal into repeatable CLI commands, MCP tools, and a local Web API for market data, forecasting, regime detection, signal processing, risk analysis, and reporting.

Use it to explore ideas, build repeatable research workflows, and integrate MT5 data with assistants or local applications. It is a toolkit, not a trading strategy or financial advice.

Who Is This For?

  • Newer traders / learners: Follow guided workflows (no quant background required).
  • Systematic traders: Prototype ideas, backtest quickly, and automate via CLI/MCP.
  • Data folks: Pull MT5 market data into repeatable analysis pipelines.

Platform Support (Important)

  • Windows is required to run MetaTrader 5 (and therefore to run mtdata against MT5).
  • If you're on macOS/Linux, run mtdata on a Windows VM or Windows machine and connect remotely (MCP/Web API).
  • Python 3.14 is the supported runtime for the packaged dependency set in this repo.

Safety First

  • mtdata includes trade_* commands that can place/modify/close real orders on the account currently logged into MT5.
  • Use a demo account until you understand the tools and your broker setup.
  • There is no built-in “paper trading” mode in mtdata; use an MT5 demo account for simulated execution.
  • When a trading command supports --dry-run true, preview the action before sending anything to MT5.
  • If you only want research, stick to data_*, forecast_*, regime_*, patterns_*, and report_* commands.

Capabilities

CategoryWhat It DoesKey Tools
DataFetch candles, ticks, market depth, and ranked market scans from MT5data_fetch_candles, data_fetch_ticks, market_depth_fetch, market_ticker, symbols_top_markets
ForecastingPredict price paths with classical, ML, or foundation modelsforecast_generate, forecast_backtest_run
VolatilityEstimate future movement and compare realized volatility across horizonsforecast_volatility_estimate, volatility_term_structure
RegimesDetect trending, ranging, or crisis market statesregime_detect
BarriersCalculate TP/SL hit probabilities via simulationforecast_barrier_prob, forecast_barrier_optimize
PatternsIdentify candlestick, chart, Elliott, and fractal patternspatterns_detect
IndicatorsCompute 100+ technical indicatorsdata_fetch_candles --indicators
DenoisingSmooth price data to reveal trends--denoise option
TemporalTest stationarity and discover automatic or calendar seasonalitystationarity_test, seasonality_detect, temporal_analyze
DiagnosticsFlag anomalous returns, volume, and bar rangesoutliers_detect
Multi-assetExplore correlation, lead/lag structure, and pairwise or multivariate cointegrationcorrelation_matrix, cross_correlation, cointegration_test
ScanningScreen MT5 symbols by spread, price change, volume, RSI, and SMAsymbols_top_markets, market_scan
Strategy BacktestingBacktest simple SMA/EMA/RSI trading rules on MT5 candlesstrategy_backtest
TradingPlace orders, manage positions, review performance, and estimate tail or scenario risktrade_place, trade_close, trade_var_cvar_calculate, trade_stress_test
Async TrainingRun heavyweight forecast training in the background and reuse cached modelsforecast_train, forecast_task_status, forecast_task_wait, forecast_models_list, forecast_models_delete
NewsUnified, ranked news + economic calendar relevant to a symbolnews
FundamentalsUS equity data, screening, news, calendarsfinviz_fundamentals, finviz_screen, finviz_calendar
OptionsOptions chains and QuantLib barrier pricingoptions_chain, options_barrier_price

Notes:

  • market_depth_fetch is enabled only when MTDATA_ENABLE_MARKET_DEPTH_FETCH=1 and your broker provides Level 2/DOM data.
  • Options-chain tools use Yahoo Finance by default and support Tradier with MTDATA_OPTIONS_PROVIDER=tradier plus MTDATA_OPTIONS_API_KEY. The pure QuantLib calculator options_barrier_price works independently of external options-chain data.

Quick Start

Prerequisites: Windows + Python 3.14 + MetaTrader 5 installed and running (demo account recommended). For the full install on Windows, also install Visual Studio Build Tools 2022 with the Desktop development with C++ workload.

# Optional but recommended: create an isolated conda environment first
conda create -n mtdata python=3.14 -y
conda activate mtdata

# Lean core install
pip install -e .

# Full stable research/web install
pip install -r requirements.txt

# Verify MT5 connection (lists symbols from the running terminal)
mtdata-cli symbols_list --limit 5

# Scan the current MT5 watchlist for top markets
mtdata-cli symbols_top_markets --rank-by all --limit 5 --timeframe H1

# Fetch recent candles
mtdata-cli data_fetch_candles EURUSD --timeframe H1 --limit 50

# Generate a baseline price forecast
mtdata-cli forecast_generate EURUSD --timeframe H1 --horizon 12 --method theta

After these commands work, move through the docs in the learning path below. Keep the first session read-only unless you are using a demo account and intentionally testing trading commands.

Notes:

  • pip install -e . now installs the lean core package only.
  • pip install -r requirements.txt installs the validated Python 3.14 stack from package-index releases, including Chronos, StatsForecast, sktime, mlforecast, news embeddings, and the Web API.
  • NeuralForecast-based models (nhits, tft, patchtst, nbeatsx) are not installed by requirements.txt or any package extra today; install them manually with pip install neuralforecast torch if you want to experiment with them.
  • Conda is a supported way to isolate the install before running the pip commands above.
  • Git-backed add-ons stay explicit: pip install -e .[forecast-timesfm] for TimesFM, pip install -e .[patterns-ext] for stock-pattern, pip install -e .[news-ycnbc] for the CNBC adapter, or pip install -e .[all-git] for everything in one go.
  • GluonTS/Lag-Llama and GluonTS gt_* methods remain excluded from the supported Python 3.14 environment because upstream runtime constraints are still incompatible.
  • Optional accelerators hnswlib and tsdownsample remain excluded from the supported default install, but an opt-in native/source-build path is documented via requirements-optional-src.txt and docs/SETUP.md.

Documentation

New here? Follow this learning path: docs/SETUP.md → docs/GLOSSARY.md → docs/CLI.md → docs/SAMPLE-TRADE.md (then docs/SAMPLE-TRADE-ADVANCED.md and deep dives).

Getting Started

  • Setup & Configuration — Installation, MT5 connection, environment variables
  • CLI Guide — Command conventions, output formats, help system
  • Glossary — Explanations of all technical terms with real-world examples
  • Docs Index — One-page map of all docs

Core Topics

External Data & Options

Tutorials

Reference

Configuration

Create a .env file in the project root:

MT5_LOGIN=12345678
MT5_PASSWORD=your_password
MT5_SERVER=your_broker_server
MT5_SERVER_TZ=Europe/Athens   # Or use MT5_TIME_OFFSET_MINUTES=120

# Optional trade guardrails
MTDATA_TRADE_GUARDRAILS_ENABLED=1
MTDATA_TRADE_ALLOWED_SYMBOLS=EURUSD,BTCUSD,XAUUSD
MTDATA_TRADE_MAX_VOLUME_BY_SYMBOL=EURUSD:0.50,BTCUSD:0.03
MTDATA_TRADE_MAX_RISK_PCT_OF_EQUITY=1.5

mtdata reads dozens of environment variables covering MT5 connection, timezone, MCP/Web API server settings, news embeddings, Finviz tuning, GPU acceleration, and more. See Environment Variables Reference for the full list, including the trade-guardrail variables and a starter .env template.

Architecture

mtdata/
├── requirements-optional-src.txt  # Opt-in native/source-built accelerators
├── src/mtdata/
│   ├── bootstrap/      # Runtime startup, settings, tool loading
│   ├── core/           # Tool registry, schemas, server logic, MCP tools
│   │   ├── cli/        # Dynamic CLI (argparse) + parsing/, runtime/ subpackages
│   │   ├── data/       # `data_fetch_*` and `wait_event` tools
│   │   ├── regime/     # Regime detection (HMM, BOCPD, MS-AR)
│   │   ├── report/     # `report_generate` runtime
│   │   ├── report_templates/  # Per-style report templates
│   │   └── trading/    # `trade_*` tools, account / positions / risk modules
│   ├── forecast/       # Forecasting methods, engines, model store, task manager
│   ├── patterns/       # Pattern detection algorithms
│   ├── services/       # MT5 data access, Finviz, options/news data
│   ├── shared/         # Shared constants, schemas, validators
│   └── utils/          # Shared utilities (indicators, denoising, etc.)
├── webui/              # React + Vite frontend
├── docs/               # Documentation
└── tests/              # Test suite

License

MIT

Ver o original no GitHub

Bom para

Relacionados