MTsocketAPI Commands

MTsocketAPI accepts commands in the port TCP 77. We can use any programming language or a tool like PuTTY to start sending commands.

Important: You must send JSON commands in a single line like this:

{"MSG":"HELP"}

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)"}

Note: In the documentation, we will show JSON messages with beauty format applied to easily see the information.

Note: 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: