cTrader vs MetaTrader 4 API
The same fields from the cTrader Open API record and the MetaTrader 4 (MQL4) record, side by side. No winner is picked: which one suits you depends on what you are building.
Risk warning: CFDs and spread bets are complex instruments and come with a high risk of losing money rapidly due to leverage. You can lose money on these products, and each provider publishes its own loss figure under FCA rules. You should consider whether you understand how they work and whether you can afford to take the high risk of losing your money. Automated and API trading can amplify losses through bugs, connectivity failures and runaway orders.
What the two records show
Differences you can see in the records themselves. These are counts of what this site holds, not a verdict on either API.
- cTrader Open API is a platform API, offered through the brokers that carry the platform. MetaTrader 4 (MQL4) is a platform API, offered through the brokers that carry the platform.
- This site has not yet documented individual endpoints for cTrader Open API or for MetaTrader 4 (MQL4).
- This site has decoded 53 error codes for cTrader Open API and 161 error codes for MetaTrader 4 (MQL4).
- The limits register holds 2 limit records for cTrader Open API and no limit records for MetaTrader 4 (MQL4). Each limit record carries its own scope.
- The cTrader Open API record holds a demo claim, verified at its source. The MetaTrader 4 (MQL4) record holds a demo claim, verified at its source. The wording of each is in the Demo row below.
- A quickstart is built here for cTrader Open API only.
cTrader Open API and MetaTrader 4 (MQL4), field by field
| Field | cTrader Open API | MetaTrader 4 (MQL4) |
|---|---|---|
| Kind | Platform API, offered by many brokers | Platform API, offered by many brokers |
| API family | Protobuf over TCP/WebSocket, JSON over TCP/WebSocket, Python package, C# package | MQL4, WebRequest (HTTP from MQL4) |
| How you get access | Register an app at openapi.ctrader.com; Spotware reviews new apps, so describe your use case in detail.Creating a new applicationchecked | Install the MT4 terminal from a broker and write Expert Advisors or scripts in MQL4.Install terminal (MT4 help)checked |
| Who can use it | Supported by all trading accounts of any cTrader affiliated brokers by default, which means both demo and live accounts.cTrader Open APIchecked | Real accounts can only be opened by brokerage companies that offer MT4.Opening of accounts (MT4 help)checked |
| Demo | Yes: separate demo endpoint; demo and live environments are fully separated.Proxies and endpointschecked | Yes: demo accounts can be opened from within the terminal.Opening of accounts (MT4 help)checked |
| Authentication | OAuth 2.0 authorisation code flow: the auth code lives 1 minute, the access token 30 days. Scopes are accounts, which is read only, and trading, which is full.Account authenticationchecked | No API keys: code runs inside a terminal already logged in to a trading account.MQL4 Referencechecked |
| Streaming | Yes: spot quotes, depth of market and execution events on the same connection, at 50 requests a second per connection (5 for historical data) with a heartbeat every 10 seconds. Host live1.p.ctrader.com port 5035, SSL mandatory for TCP and WebSocket. Spotware recommends at most two connections, one demo and one live, each carrying an unlimited number of accounts of that type.Messageschecked | In-terminal events only (new tick, timer, depth changes); no external streaming API.MQL4 Referencechecked |
| History depth | Trend bars and ticks by from/to timestamp with optional count; deals by range with maxRows. Cash flow history max 1 week per request.Spotware OpenApiMessages.protochecked | Bars limited to the terminal's max bars in chart. Closed orders limited to what the Account History tab has loaded.MQL4 docs: CopyRateschecked |
| Limits |
| None recorded |
| Endpoints documented here | None yet | None yet |
| Error codes decoded here | 53 | 161 |
| Official documentation | help.ctrader.com | docs.mql4.com |
Go deeper on each side
cTrader Open API
- cTrader API page, the full record
- cTrader API quickstart, credentials to a first call
- cTrader API limits, in the table above
- cTrader API error codes, each with its fix
- cTrader Open API with Python
MetaTrader 4 (MQL4)
- MetaTrader 4 API page, the full record
- No MetaTrader 4 API quickstart is built here yet
- MetaTrader 4 API limits, in the table above: none recorded
- MetaTrader 4 API error codes, each with its fix
All comparisons. New to this? Getting started with API trading.