Modify
Modify the stop loss and/or take profit on an open position or pending order.
Endpoint
Section titled “Endpoint”POST /v1/modify
Request Parameters
Section titled “Request Parameters”| Parameter | Type | Required | Description |
|---|---|---|---|
ticket | integer | Yes | Position or order ticket number |
sl | number | No | New stop loss price. Set to 0 to remove an existing stop loss |
tp | number | No | New take profit price. Set to 0 to remove an existing take profit |
At least one of sl or tp must be provided.
Example Request
Section titled “Example Request”Set both SL and TP:
curl -X POST https://interface.xbtfx.com/v1/modify \ -H "Authorization: Bearer your_api_key_here" \ -H "Content-Type: application/json" \ -d '{ "ticket": 12345678, "sl": 1.08200, "tp": 1.09800 }'Remove stop loss while keeping take profit unchanged:
curl -X POST https://interface.xbtfx.com/v1/modify \ -H "Authorization: Bearer your_api_key_here" \ -H "Content-Type: application/json" \ -d '{ "ticket": 12345678, "sl": 0 }'Response
Section titled “Response”{ "status": "success", "retcode": 10009}Response Fields
Section titled “Response Fields”| Field | Type | Description |
|---|---|---|
status | string | Result status |
retcode | integer | MT5 return code. 10008 or 10009 indicate success |