Skip to content

Update Close Trade

UpdateCloseTrade

Updates the details of an open trade before it is closed, based on the provided trade parameters.

int UpdateCloseTrade(const TradeRecord& source_trade);

Parameters

  • source_trade — constant reference to a TradeRecord structure containing the updated trade parameters.

Return Value

  • RET_OK — trade successfully updated.
  • RET_* — error code if the update fails.
  • Return Codes

Example

TradeRecord tr = {};
tr.order = 123456;
tr.login = 1001;
tr.symbol = "EURUSD";
tr.volume = 500; // Partial close
tr.close_price = 1.0760;

if (UpdateCloseTrade(tr) == RET_OK) {
    // Trade updated successfully before closing
}

Warning

  • This function only updates the open trade's parameters before it is closed.
  • It does not perform the close operation — call CloseTrade separately after updating.
  • Always check the return code to confirm the update was successful.