What is MetaPortAPI?
MetaPortAPI is an Expert Advisor (EA) for MetaTrader 5. When you attach it to a chart it opens local network ports and turns your terminal into an API server. Your own programs can then:
- read real-time prices, symbol details, account and terminal information
- send, modify and close orders — market, limit and stop
- query indicators (moving average, ATR or any custom indicator)
- download trade history, candles and ticks
- read the economic calendar
- stream ticks, OHLC bars, market depth and trade events over WebSocket
Everything is plain JSON over standard protocols, so you can use Python, C#, Java, Node.js, Go, R, C++, PowerShell, MATLAB — or simply curl.
curl "http://127.0.0.1:81/v1/quote?symbol=EURUSD"{"MSG":"QUOTE","SYMBOL":"EURUSD","ASK":1.11214,"BID":1.11208,"FLAGS":6, "TIME":"2026.10.28 08:04:55.523","VOLUME":0,"ERROR_ID":0, "ERROR_DESCRIPTION":"The operation completed successfully"}Why a local API?
Section titled “Why a local API?”- Privacy — data and strategies stay on your own computer or VPS.
- Speed — no round trip through somebody else’s cloud.
- Reliability — MetaPortAPI uses the terminal’s own, official connection to your broker instead of imitating the MetaTrader protocol.
- Freedom — no MQL5 needed; debug in the tools you already know.