An MT4 API on a real, hosted MetaTrader 4 terminal
MetaTrader 4 has no official API of its own. Tickwire runs an MT4 terminal for each of your accounts and gives it the same REST and WebSocket API as MT5, with the same fields. Where MT4 can't do something, the call says so instead of returning made-up data.
What works on MT4
Most of the API is the same on both platforms. MT4 is older and lacks three features. Calls for them return
the error not_supported_on_mt4.
| Capability | MT5 | MT4 |
|---|---|---|
| Account information, positions, pending orders | Yes | Yes |
| Market, limit and stop orders; modify; full and partial close | Yes | Yes |
| Quotes and candles | Yes, 21 timeframes | Yes: 1m 5m 15m 30m 1h 4h 1d 1w 1mn |
| History | Deals, orders and positions | Closed orders, exposed as deals and history orders |
| Streaming, health, webhooks, audit log, idempotency keys | Yes | Yes |
| Close-by | Yes, on hedging accounts | Depends on the broker |
| Market depth | Yes | not_supported_on_mt4 |
| Historical ticks | Yes | not_supported_on_mt4 |
| Stop-limit orders | Yes | not_supported_on_mt4 |
Live MT4 ticks are captured from the time you subscribe, so there's no tick history to read back.
Check before you call
Ask an account what it supports instead of catching errors. Code written for both platforms can branch on the answer.
# Ask the account what it supports
curl -s "https://api.tickwire.io/users/current/accounts/acc_7Qx/capabilities" -H "auth-token: $TW_KEY" { "platform": "mt4", "marketDepth": false, "tickHistory": false,
"stopLimitOrders": false, "closeBy": true } An unsupported call
{ "error": "not_supported_on_mt4",
"message": "Market depth isn't available on MetaTrader 4." } Nothing is faked. You get a clear error and can fall back, for example to candles instead of ticks.
MT4 details we handle for you
- Partial closes. MT4 reopens the rest of a position under a new ticket. Tickwire finds it and returns it, so you keep track.
- History as deals. MT4 only keeps closed orders. Tickwire turns them into deals and history orders with the same fields as MT5.
- Safe retries. Send an
Idempotency-Keywith each order. A retry gets the first result back. If a result can't be confirmed, the answer isunknown, not a guess. - Broker time. Broker-local times are labelled as such. UTC fields are real UTC.
- Any broker. Give the server name from the terminal's login dialog. There's no per-broker setup.
One API for MT4 and MT5
Pick the platform when you create an account ("platform": "mt4"). After that, every endpoint,
field and stream frame is the same as on MT5. The terminal routes live at
/mt4/{id}/…, next to /mt5/{id}/….
MT4 accounts for AI agents
The Tickwire MCP server works with MT4 accounts too. Connect Claude, ChatGPT or another MCP app, sign in, and pick the accounts it may use. See AI trading agents.
https://api.tickwire.io/mcp Try the MT4 API
7-day free trial. Then from $12 per account a month, the same price as MT5. See pricing.