Skip to content

Close All

Close all open positions on the account, or close all positions for a specific symbol. Close commands are sent in parallel for fast execution.

POST /v1/close-all

Closes every open position on the account. Up to 20 positions are closed concurrently.

Weight: 10

ParameterTypeRequiredDescription
commentstringNoClose comment. Max 27 characters, ASCII only
Terminal window
curl -X POST https://interface.xbtfx.com/v1/close-all \
-H "Authorization: Bearer your_api_key_here" \
-H "Content-Type: application/json" \
-d '{
"comment": "close all"
}'

POST /v1/close-symbol

Closes all open positions for a specific symbol. Up to 20 positions are closed concurrently.

Weight: 10

ParameterTypeRequiredDescription
symbolstringYesSymbol to close all positions for (e.g., EURUSD)
commentstringNoClose comment. Max 27 characters, ASCII only
Terminal window
curl -X POST https://interface.xbtfx.com/v1/close-symbol \
-H "Authorization: Bearer your_api_key_here" \
-H "Content-Type: application/json" \
-d '{
"symbol": "EURUSD"
}'

Both endpoints return the same response format:

{
"closed": 3,
"failed": 0,
"total_profit": 45.60,
"details": [
{
"ticket": 12345678,
"status": "success",
"retcode": 10009,
"deal": 87654322,
"price": 1.08890,
"profit": 19.30
},
{
"ticket": 12345679,
"status": "success",
"retcode": 10009,
"deal": 87654323,
"price": 1.52110,
"profit": 12.50
},
{
"ticket": 12345680,
"status": "success",
"retcode": 10009,
"deal": 87654324,
"price": 0.65430,
"profit": 13.80
}
]
}
FieldTypeDescription
closedintegerNumber of positions successfully closed
failedintegerNumber of positions that failed to close
total_profitnumberCombined realized profit/loss from all closed positions
detailsarrayPer-position results
details[].ticketintegerPosition ticket number
details[].statusstringResult status for this position
details[].retcodeintegerMT5 return code
details[].dealintegerClosing deal ticket
details[].pricenumberClose execution price
details[].profitnumberRealized profit/loss for this position