Skip to content

ORDER_MODIFY Command

Change SL or TP for market or limit orders

Help
{
    "MSG":"HELP",
    "COMMAND":"ORDER_MODIFY",
    "DESCRIPTION":"Modify any order using the TICKET number",
    "MANDATORY_TAGS":[
        "TICKET (Integer)"
    ],
    "OPTIONAL_TAGS":[
        "PRICE (Double)",
        "SL (Double)",
        "TP (Double)",
        "EXPIRATION (String)",
        "ASYNC (Boolean)"
    ],
    "ERROR_ID":0,
    "ERROR_DESCRIPTION":"The operation completed successfully",
    "DEMO":"MTsocketAPI running in DEMO mode (www.mtsocketapi.com)"
}

Example

Single Line command (necessary for MTsocketAPI):

{"MSG":"ORDER_MODIFY", "TICKET":6549871, "SL":1.002, "TP":0}

Same command in Beauty Format:

{
    "MSG":"ORDER_MODIFY",
    "TICKET":2012142959,
    "SL":1.002
}

MTsocketAPI reply:

{
   "MSG":"ORDER_MODIFY",
   "TICKET":2012142959,
   "RETCODE":10009,
   "DEAL":0,
   "ORDER":0,
   "VOLUME":0.00,
   "PRICE":0.000000,
   "BID":0.000000,
   "ASK":0.000000,
   "REQUEST_ID":3136973156,
   "RETCODE_EXTERNAL":0,
   "ERROR_ID":0,
   "ERROR_DESCRIPTION":"The operation completed successfully"
}
Note

Please note that sending the SL or TP tag will result in an update to the value. Conversely, sending the SL or TP tag set to 0 will lead to the removal of the SL or TP.