Skip to content

Close

Close an open position by its ticket number. Supports partial closes by specifying a volume less than the full position size.

POST /v1/close

ParameterTypeRequiredDescription
ticketintegerYesPosition ticket number to close
volumenumberNoVolume to close in lots. Omit to close the full position. Specify a smaller value for a partial close
commentstringNoClose comment. Max 27 characters, ASCII only

Close a full position:

Terminal window
curl -X POST https://interface.xbtfx.com/v1/close \
-H "Authorization: Bearer your_api_key_here" \
-H "Content-Type: application/json" \
-d '{
"ticket": 12345678
}'

Partial close (close 0.05 lots of a 0.1 lot position):

Terminal window
curl -X POST https://interface.xbtfx.com/v1/close \
-H "Authorization: Bearer your_api_key_here" \
-H "Content-Type: application/json" \
-d '{
"ticket": 12345678,
"volume": 0.05
}'
{
"status": "placed",
"retcode": 10008
}
FieldTypeDescription
statusstringplaced or filled or rejected
retcodeintegerMT5 return code. 10008 or 10009 indicate success
dealintegerClosing deal ticket number (present when status is filled)
pricenumberClose execution price (present when status is filled)