A lightweight Expert Advisor that turns your MetaTrader terminal into a REST API with WebSockets. Any language that speaks HTTP can read prices, send orders and manage your account.
Free with demo accounts. Works with any MT4 or MT5 broker.
Everything goes through plain HTTP requests and JSON replies, so there is nothing new to learn.
Real-time ticks and OHLC candles for your application. Build your own indicators in your preferred language.
Send market, limit and stop orders to your MT4 or MT5 account, then modify or close them, fully or partially.
Read the values of SMA, ATR, Momentum or any custom indicator of your terminal, and use them to manage your orders.
Retrieve past trades and price history, apply filters, make calculations or export everything to CSV.
Get the calendar events of MetaTrader 5 by date, currency or country, with actual and forecast values.
Subscribe to ticks, candles, market depth and order events and receive them over WebSockets as they happen.
Ports 77 and 78 remain available for programs written for previous versions. Key features · Basic usage
Every reply is JSON with an ERROR_ID and an ERROR_DESCRIPTION. The API is described with OpenAPI 3, so you can generate a client for your language.
| Endpoints (MetaTrader 5) | What you get | |
|---|---|---|
| Quotes | GET /v1/quote | Bid, ask, volume and time of a symbol |
| Orders | POST /v1/order /order/close /order/modifyGET /v1/order/list /order/info | Send, close, modify and list open and pending orders |
| Account | GET /v1/account | Balance, equity, margin, leverage and trading permissions |
| Symbols | GET /v1/symbol/list /symbol/info | The broker's symbols and their full specification |
| History | GET /v1/history/prices /history/ticks /history/orders | Candles, ticks, deals, orders and positions between two dates |
| Indicators | GET /v1/indicator/ma /indicator/atr /indicator/custom | Moving average, ATR and any custom indicator |
| Calendar | GET /v1/calendar | Economic events by date, currency or country |
| Streaming | POST /v1/track/prices /track/ohlc /track/mbook /track/orders | Start or stop the WebSocket streams of ticks, candles, market depth and order events |
| Terminal | GET /v1/terminal | Information about the MetaTrader terminal |
The MTsocketAPI SDK is a native library for MetaTrader 4 and 5. Your program connects directly to your broker's MT4 or MT5 server, so there is no terminal to install, update or keep open. It is included in your subscription.
Download it, attach it to a chart and make your first request in a few minutes.
Trading involves a high risk of loss. MTsocketAPI is a software tool, not investment advice: always test your programs on a demo account first. You are responsible for the orders your software sends. See the Terms of Service.
Created with Mobirise
Web Site Maker