closeAll: Close every open position (long and short), on all symbols
Close every open position (long and short), on all symbols.
At a glance
Section titled “At a glance”-
Action:
closeAll(case-sensitive) -
Group: Close positions
-
From the dashboard: yes, on the Send Command page
-
HTTP 200 means queued, not executed. See how delivery works and find where an alert stopped.
Fields
Section titled “Fields”| Field | Type | Required | Unit | Description |
|---|---|---|---|---|
license |
string | Yes | text | Your license key. In examples it is written YOUR_LICENSE_KEY. |
action |
string | Yes | text | Always closeAll. Case-sensitive. |
The webhook rejects unknown fields, missing required fields and wrong types with HTTP 422 before anything is queued. Field names are case-sensitive.
Examples
Section titled “Examples”Replace YOUR_LICENSE_KEY with your key. Send the body as the alert message in TradingView, or with any HTTP client.
Close all positions
Section titled “Close all positions”{ "license": "YOUR_LICENSE_KEY", "action": "closeAll"}curl -X POST "https://dev.api.zb-connector.com/webhook/" \ -H "Content-Type: application/json" \ -d '{"license":"YOUR_LICENSE_KEY","action":"closeAll"}'import requests
payload = """{ "license": "YOUR_LICENSE_KEY", "action": "closeAll"}"""
response = requests.post( "https://dev.api.zb-connector.com/webhook/", data=payload, headers={"Content-Type": "application/json"}, timeout=10,)print(response.status_code, response.text)const response = await fetch("https://dev.api.zb-connector.com/webhook/", { method: "POST", headers: { "Content-Type": "application/json" }, body: JSON.stringify({ "license": "YOUR_LICENSE_KEY", "action": "closeAll" }),});console.log(response.status, await response.text());What you see
Section titled “What you see”After a successful run the MT5 Experts log shows:
Closed position <ticket> successfully (symbol: <symbol>)Close Summary: Success = <n>, Failed = <n>In the dashboard, the command appears in Command History on the License Details page. What each status means.
Errors and fixes
Section titled “Errors and fixes”| Where you see it | Message or code | Cause | Fix |
|---|---|---|---|
| MT5 Experts log | No open positions found. |
The account has no open positions. | Nothing to do. |
| Broker, MT5 return code | 10018 Market is closed | The market for a symbol is closed; that position stays open. | Send the command again when the market is open. |
- Applies to all symbols. To close one symbol only, use closeSymbol (direction both is the default).
- Only positions in the EA’s trade scope are closed (by default, trades opened by this EA).
Related
Section titled “Related”- Commands overview and the cheat sheet
- close_percentage: close a percentage of one position
- closeByID: close the position (or positions) with a given positionID
- closeByLotSize: close a given number of lots of one position
- closeLong: close every open buy (long) position, on all symbols
Verified for EA v1.9 · dashboard 2026-10-05 · reviewed by Claude Code (owner review pending)
Trading involves substantial risk of loss. ZB Connector is software only; it does not provide investment advice, signals or brokerage services.