MT4 and MT5
One API for both platforms, and the few things MT4 can't do.
Pick the platform when you create an account ("platform": "mt4" or "mt5"). After that, every
endpoint, field and stream frame is the same.
What’s different
MT4 is an older platform and lacks some features. Calls for them return not_supported_on_mt4:
| Capability | MT5 | MT4 |
|---|---|---|
Market depth (current-book, marketDepth stream) | Yes | not_supported_on_mt4 |
| Historical ticks | Yes | not_supported_on_mt4 |
| Stop-limit orders | Yes | not_supported_on_mt4 |
| Close-by | Yes, on hedging accounts | Depends on the broker |
| Timeframes | 21, from 1m to 1mn | 1m 5m 15m 30m 1h 4h 1d 1w 1mn |
| History | Deals, orders and positions | Closed orders, exposed as deals and history orders |
Ask the account up front instead of catching errors:
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 returns HTTP 400:
{ "error": "not_supported_on_mt4", "message": "Market depth isn't available on MetaTrader 4." }
Hedging and netting (MT5)
MT5 accounts are either hedging (many positions per symbol) or netting (one). marginMode in
account information tells you which. On hedging accounts, closes must name a positionId; on
netting accounts, positions are identified by their MT5 position identifier, which stays stable
while the position is scaled in and out.