Skip to content
REST · WebSocket · TCP for MetaTrader 5

Turn your MT5 terminal into a local trading API.

MetaPortAPI is a lightweight Expert Advisor that lets any script or app read prices, send orders and stream market data from MetaTrader 5 — in the language you already use, on the machine you already trust.

Start free on demoRead the docs
PythonC#Node.jsPowerShellGoC++R
127.0.0.1:81
$ curl "http://127.0.0.1:81/v1/quote?symbol=XAUUSD"
{"MSG":"QUOTE","SYMBOL":"XAUUSD","ASK":4047.716,
 "BID":4047.548,"FLAGS":6,"TIME":"2026.10.28 08:04:58.326",
 "VOLUME":0,"ERROR_ID":0,
 "ERROR_DESCRIPTION":"The operation completed successfully"}
EURUSD1.11208
GBPUSD1.32830
XAUUSD4047.548
Everything MT5 can do

One API for prices, orders, indicators and history.

Orders, end to end

Market, limit and stop orders with stop loss, take profit, magic number and comment. Modify them, close them fully or partly, and list everything open or pending.

POST /v1/order/v1/order/modify/v1/order/close/v1/order/list

Live streaming

Ticks, OHLC bars, depth of market and trade events pushed over WebSocket the moment they happen.

ws://127.0.0.1:81

Real-time quotes

Bid, ask and tick time for any symbol your broker offers.

Indicators

Moving averages, ATR, or any custom indicator you have installed — values straight from the terminal.

History & reports

Closed positions, deals and orders by date, plus candle and tick history for research and backtests.

Account, symbols & calendar

Balance, equity and margin; full symbol specifications and trading sessions; economic calendar events by currency or country.

Built-in safety lock

Demo-only trading mode and localhost-only access are on by default, and you can set a maximum lot per order. You decide when to switch them off.

How it works

Attach one EA. Talk to it over standard protocols.

MetaPortAPI runs inside your terminal and opens local ports. Your code sends a request, the EA carries it out in MT5 and answers in JSON.

01 · YOUR CODE

Script, bot or app

Any language, on Windows, Linux or mobile.

02 · METAPORTAPI EA

Inside MetaTrader 5

:81 REST + WebSocket:77 JSON commands:78 data stream
03 · YOUR BROKER

Through MT5 itself

Orders use the terminal's own connection — nothing reverse-engineered.

See the full architecture →

Private by design

Your strategy and account data never pass through a third-party cloud.

No cloud hop

Requests stay on your machine or VPS, so latency is the terminal's own.

Standard tooling

OpenAPI 3 spec, plain JSON, curl-friendly. No MQL5 needed on your side.

Many accounts

Run one terminal per account on different ports for hedging, arbitrage or copy trading.

Developers

Your first trade in a few lines.

Full API reference →
import requests

API = "http://127.0.0.1:81"

# current price
q = requests.get(f"{API}/v1/quote", params={"symbol": "XAUUSD"}).json()
print(q["BID"], q["ASK"])

# buy 0.05 lot (demo account)
r = requests.post(f"{API}/v1/order",
                  params={"symbol": "XAUUSD", "volume": 0.05,
                          "type": "ORDER_TYPE_BUY"}).json()
print(r["RETCODE"], r["ORDER"])

Free on demo. Pay when you go live.

Every feature works free on demo accounts in 7-hour sessions. Upgrade when you are ready to trade a live account.

See pricingDownload