ORDER_CLOSE Command
Close partially or fully an order using the ticket number. Also it closes stop or limit orders.
Help
{
"MSG":"HELP",
"COMMAND":"ORDER_CLOSE",
"DESCRIPTION":"Close any order using the TICKET number",
"MANDATORY_TAGS":[
"TICKET (Integer)"
],
"OPTIONAL_TAGS":[
"VOLUME (Double)",
"PRICE (Double)",
"SLIPPAGE (Double)",
"ASYNC (Boolean)"
],
"ERROR_ID":0,
"ERROR_DESCRIPTION":"The operation completed successfully"
}
Examples
Fully close MT5 order
Single Line command (necessary for MTsocketAPI):
Same command in Beauty Format:MTsocketAPI reply:
{
"MSG":"ORDER_CLOSE",
"TICKET":2020570871,
"TYPE":"FULLY_CLOSED",
"RETCODE":10009,
"DEAL":2015119294,
"ORDER":2020570914,
"VOLUME":0.10,
"PRICE":1.064990,
"BID":1.064990,
"ASK":1.065030,
"REQUEST_ID":3136973157,
"RETCODE_EXTERNAL":0,
"ERROR_ID":0,
"ERROR_DESCRIPTION":"The operation completed successfully",
"DEMO":"MTsocketAPI running in DEMO mode (www.mtsocketapi.com)"
}
Partially close MT5 order
Single Line command (necessary for MTsocketAPI):
Same command in Beauty Format:MTsocketAPI reply:
{
"MSG":"ORDER_CLOSE",
"TICKET":2012142959,
"TYPE":"PARTIALLY_CLOSED",
"RETCODE":10009,
"DEAL":2015119329,
"ORDER":2020570959,
"VOLUME":0.02,
"PRICE":1.065180,
"BID":1.065180,
"ASK":1.065220,
"REQUEST_ID":3136973159,
"RETCODE_EXTERNAL":0,
"ERROR_ID":0,
"ERROR_DESCRIPTION":"The operation completed successfully",
"DEMO":"MTsocketAPI running in DEMO mode (www.mtsocketapi.com)"
}