Skip to content

Modify

Modify the stop loss and/or take profit on an open position or pending order.

POST /v1/modify

ParameterTypeRequiredDescription
ticketintegerYesPosition or order ticket number
slnumberNoNew stop loss price. Set to 0 to remove an existing stop loss
tpnumberNoNew take profit price. Set to 0 to remove an existing take profit

At least one of sl or tp must be provided.

Set both SL and TP:

Terminal window
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:

Terminal window
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
}'
{
"status": "success",
"retcode": 10009
}
FieldTypeDescription
statusstringResult status
retcodeintegerMT5 return code. 10008 or 10009 indicate success