long: Open a buy (long) market position
Open a buy (long) market position.
At a glance
Section titled “At a glance”-
Action:
long(case-sensitive) -
Group: Open 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 long. Case-sensitive. |
symbol |
string | Yes | text | Symbol as your broker names it in MT5 (for example EURUSD). The EA adds the Symbol prefix / Symbol suffix inputs if you set them. |
volume |
number | Yes | lots | Position size in lots. The EA rounds it to the symbol’s lot step and clamps it to the broker’s minimum and maximum volume. Allowed: greater than 0. |
sl |
number | No | price level | Stop loss. A price level by default. If the EA input Stop level mode is set to pips or ticks, it is a distance from the entry price in that unit. 0 or omitted means no stop loss. Allowed: 0 or more. Default: 0. |
tp |
number | No | price level | Take profit. Same unit rule as sl. 0 or omitted means no take profit. Allowed: 0 or more. Default: 0. |
positionID |
string | No | text | Your name for this position, stored as the MT5 order comment. Later commands use it to target the position. If omitted, the server sets one (CMD followed by a number). |
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.
Buy 0.10 lots of EURUSD with a stop loss and a take profit
Section titled “Buy 0.10 lots of EURUSD with a stop loss and a take profit”{ "license": "YOUR_LICENSE_KEY", "action": "long", "symbol": "EURUSD", "volume": 0.1, "sl": 1.08, "tp": 1.1, "positionID": "eurusd_breakout_1"}curl -X POST "https://dev.api.zb-connector.com/webhook/" \ -H "Content-Type: application/json" \ -d '{"license":"YOUR_LICENSE_KEY","action":"long","symbol":"EURUSD","volume":0.1,"sl":1.08,"tp":1.1,"positionID":"eurusd_breakout_1"}'import requests
payload = """{ "license": "YOUR_LICENSE_KEY", "action": "long", "symbol": "EURUSD", "volume": 0.1, "sl": 1.08, "tp": 1.1, "positionID": "eurusd_breakout_1"}"""
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": "long", "symbol": "EURUSD", "volume": 0.1, "sl": 1.08, "tp": 1.1, "positionID": "eurusd_breakout_1" }),});console.log(response.status, await response.text());Minimal buy, no stops
Section titled “Minimal buy, no stops”{ "license": "YOUR_LICENSE_KEY", "action": "long", "symbol": "XAUUSD", "volume": 0.01}curl -X POST "https://dev.api.zb-connector.com/webhook/" \ -H "Content-Type: application/json" \ -d '{"license":"YOUR_LICENSE_KEY","action":"long","symbol":"XAUUSD","volume":0.01}'import requests
payload = """{ "license": "YOUR_LICENSE_KEY", "action": "long", "symbol": "XAUUSD", "volume": 0.01}"""
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": "long", "symbol": "XAUUSD", "volume": 0.01 }),});console.log(response.status, await response.text());What you see
Section titled “What you see”After a successful run the MT5 Experts log shows:
✅ Trade placed successfully. Ticket=<ticket> | long <symbol> | Lot=<lots> | SL=<sl> | TP=<tp> | posID=<positionID>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 | ❌ handleCommand: "long/short" needs a non-empty symbol and volume>0 |
The command reached the EA without a symbol or with a volume of 0 or less. | Send symbol and a volume greater than 0. |
| MT5 Experts log | 🔒 Trade blocked — EA disabled via setEAStatus |
The EA’s remote switch is off. | Turn the EA back on from the dashboard, or send setEAStatus with enabled true. |
| MT5 Experts log | 🔒 Trade blocked — trading disabled: <reason> |
A profit/loss safeguard limit has tripped. | Check the safeguard state in the dashboard and reset it when appropriate. |
| MT5 Experts log | Max total open positions reached: <n> |
The account already holds the maximum number of positions set in the EA inputs. | Close positions or raise Max open positions (account-wide) in the EA inputs. |
| MT5 Experts log | Max open positions for symbol <symbol> reached: <n> |
The symbol already holds the maximum number of positions set in the EA inputs. | Close positions on that symbol or raise Max open positions per symbol. |
| MT5 Experts log | Failed to select symbol: <symbol> |
The symbol does not exist at your broker under that name. | Use the exact MT5 symbol name, or set the Symbol prefix / suffix inputs. |
| Broker, MT5 return code | 10016 Invalid stops in the request | The stop loss or take profit is on the wrong side of the price or too close to it. | Check the sl/tp values and the Stop level mode input. |
| Broker, MT5 return code | 10014 Invalid volume in the request | The volume is not allowed for this symbol. | Check the symbol’s minimum volume and lot step in MT5. |
| Broker, MT5 return code | 10019 Not enough money to complete the request | Not enough free margin for this volume. | Reduce volume or add funds (demo first). |
| Broker, MT5 return code | 10027 Autotrading disabled by client terminal | Algo Trading is switched off in the MT5 terminal. | Turn on Algo Trading in the MT5 toolbar. |
- Opening is blocked while the EA is switched off or a safeguard limit is tripped.
- The EA checks Max open positions (account-wide and per symbol) before opening.
- With the EA input Close on reverse set to Hedging, open short positions on the same symbol are closed first. With Netting, they are reduced by this volume and only the remainder opens a new position.
- Only positions in the EA’s trade scope count towards the limits (by default, trades opened by this EA).
Related
Section titled “Related”- Commands overview and the cheat sheet
- short: open a sell (short) market position
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.