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": 42.50,
"details": [
{ "ticket": 12345, "status": "filled", "deal": 99001, "profit": 15.00 },
{ "ticket": 12346, "status": "filled", "deal": 99002, "profit": 20.00 },
{ "ticket": 12347, "status": "filled", "deal": 99003, "profit": 7.50 }
]
}
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