MTsocketAPI Commands
MTsocketAPI accepts commands on port TCP 77. We can use any programming language or a tool like PuTTY to start sending commands.
Note
You must send JSON commands in a single line like this:
and the result will be returned in a single line:{"MSG":"HELP","AVAILABLE_COMMANDS":["ACCOUNT_STATUS","ATR_INDICATOR","CUSTOM_INDICATOR","EXIT","MA_INDICATOR","ORDER_SEND","ORDER_MODIFY","ORDER_CLOSE","ORDER_LIST","PRICE_HISTORY","QUOTE","SYMBOL_INFO","SYMBOL_LIST","TERMINAL_INFO","TRACK_OHLC","TRACK_PRICES","TRADE_HISTORY"],"ERROR_ID":0,"ERROR_DESCRIPTION":"no error","DEMO":"MTsocketAPI running in DEMO mode (www.mtsocketapi.com)"}
Information
In this documentation, we will show JSON messages with the beauty format applied in order to facilitate the clear presentation of the information.
Important
Every reply from the API will include the tags ERROR_ID and ERROR_DESCRIPTION. If ERROR_ID = 0 we are sure that the command was processed correctly by Metatrader but if ERROR_ID is not 0 then the ERROR_DESCRIPTION tag will include information about the error.
Available commands: