Skip to content

MngUpdateTrade

Description: Allows a manager to update an existing trade by order number. Supports partial field updates such as SL/TP, volume, price, comment, and timing values.

For closed trades, the request queues a calculated history correction. The previous profit, commission and storage are captured when the queued update is applied. The account balance changes by (new profit + new commission + new storage) - (previous profit + previous commission + previous storage). Metadata-only changes and repeated identical monetary values have zero financial delta. Supplied closed profit is not recalculated from current quotes. A closed trade must retain a nonzero close_time. Pending orders must use MngUpdatePendingTrade; financial records must use the corresponding finance commands.

accepted=true confirms admission, not completion. For a closed correction, wait for the subsequent trade:event update for the same login/order with the requested values, then reconcile account state. The acknowledgment's state is the submitted record state; it is not proof that the correction has completed. Do not retry a timed-out mutation blindly. Closed updates use the existing closed-update lifecycle, which completes in TS_CLOSED_NORMAL (3), including corrections to partial/close-by history records. The open-trade update path is unchanged.

Access Control

Requires set_trades for manager/dealer sessions. The target account must also match the manager groups and brand scope loaded from the cached manager record. Token payload is used only for manager id and session type.

Request Parameters

Name Type Required Description
order int Yes Order ID of the trade to update
login int Yes Account login to which the trade belongs
cmd int Yes Trade command (e.g., OP_BUY = 0)
volume int No Updated volume (minimal lots)
sl double No Updated Stop Loss
tp double No Updated Take Profit
profit double No Updated profit value
open_price double No Updated opening price
open_time int64 No Updated open time (epoch)
close_price double No Updated closing price
commission double No Updated commission
storage double No Updated storage
close_time int64 No Updated close time (epoch)
expiration int64 No Updated expiration time
comment string No Updated trade comment
__access object Yes Access object with type field

Request Example

{
  "order": 1001234,
  "login": 123456,
  "cmd": 0,
  "volume": 2000,
  "sl": 1.1050,
  "tp": 1.2150,
  "comment": "adjusted by manager",
  "__access": {
    "type": 1
  }
}

Response Parameters

Name Type Description
accepted bool Always true on successful acknowledgment
order int Order identifier being updated
state int Accepted request state after update acceptance
login int Target account login
symbol string Trade symbol
cmd int Trade command
volume int Current trade volume

The fields above are inside data. The TCP envelope contains extID (string, request correlation identifier), status (integer, HTTP-style result code), and data (object). Error data can contain error (string code) and message (string description). A 2xx acknowledgment does not represent execution completion.

Response Example

{
  "extID": "MngUpdateTrade_example",
  "status": 200,
  "data": {
    "accepted": true,
    "order": 1001234,
    "state": 0,
    "login": 123456,
    "symbol": "EURUSD",
    "cmd": 0,
    "volume": 2000
  }
}