# short: Open a sell (short) market position

> Open a sell (short) market position. Parameters, units, copy-ready examples, log lines and errors for the short command.

Source: https://zb-connector.com/docs/commands/short/

Open a sell (short) market position.

> **Use a demo account first.** Run every step on a MetaTrader 5 demo account. Switch to a live account only after the go-live checklist is done.

## At a glance

-   **Action:** `short` (case-sensitive)
    
-   **Group:** Open positions
    
-   **From the dashboard:** yes, on the **Send Command** page
    
-   **HTTP 200 means queued, not executed.** See [how delivery works](https://zb-connector.com/docs/reliability/how-delivery-works/) and [find where an alert stopped](https://zb-connector.com/docs/troubleshooting/find-where-it-stopped/).
    

## 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 `short`. 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

Replace `YOUR_LICENSE_KEY` with your key. Send the body as the alert message in TradingView, or with any HTTP client.

### Sell 0.10 lots of GBPUSD with a stop loss and a take profit

**JSON**

```json
{
  "license": "YOUR_LICENSE_KEY",
  "action": "short",
  "symbol": "GBPUSD",
  "volume": 0.1,
  "sl": 1.275,
  "tp": 1.255,
  "positionID": "gbpusd_reversal_1"
}
```

**curl**

```bash
curl -X POST "https://dev.api.zb-connector.com/webhook/" \
  -H "Content-Type: application/json" \
  -d '{"license":"YOUR_LICENSE_KEY","action":"short","symbol":"GBPUSD","volume":0.1,"sl":1.275,"tp":1.255,"positionID":"gbpusd_reversal_1"}'
```

**Python**

```python
import requests

payload = """
{
  "license": "YOUR_LICENSE_KEY",
  "action": "short",
  "symbol": "GBPUSD",
  "volume": 0.1,
  "sl": 1.275,
  "tp": 1.255,
  "positionID": "gbpusd_reversal_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)
```

**Node.js**

```js
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": "short",
    "symbol": "GBPUSD",
    "volume": 0.1,
    "sl": 1.275,
    "tp": 1.255,
    "positionID": "gbpusd_reversal_1"
  }),
});
console.log(response.status, await response.text());
```

### Minimal sell, no stops

**JSON**

```json
{
  "license": "YOUR_LICENSE_KEY",
  "action": "short",
  "symbol": "XAUUSD",
  "volume": 0.01
}
```

**curl**

```bash
curl -X POST "https://dev.api.zb-connector.com/webhook/" \
  -H "Content-Type: application/json" \
  -d '{"license":"YOUR_LICENSE_KEY","action":"short","symbol":"XAUUSD","volume":0.01}'
```

**Python**

```python
import requests

payload = """
{
  "license": "YOUR_LICENSE_KEY",
  "action": "short",
  "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)
```

**Node.js**

```js
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": "short",
    "symbol": "XAUUSD",
    "volume": 0.01
  }),
});
console.log(response.status, await response.text());
```

## What you see

After a successful run the MT5 **Experts** log shows:

```text
✅ Trade placed successfully. Ticket=<ticket> | short <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](https://zb-connector.com/docs/troubleshooting/find-where-it-stopped/#where-to-look).

## 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](https://zb-connector.com/docs/troubleshooting/errors/10016/) | 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](https://zb-connector.com/docs/troubleshooting/errors/10014/) | 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](https://zb-connector.com/docs/troubleshooting/errors/10019/) | Not enough free margin for this volume. | Reduce `volume` or add funds (demo first). |
| Broker, MT5 return code | [10027 Autotrading disabled by client terminal](https://zb-connector.com/docs/troubleshooting/errors/10027/) | Algo Trading is switched off in the MT5 terminal. | Turn on Algo Trading in the MT5 toolbar. |

## Notes

-   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 long 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

-   [Commands overview](https://zb-connector.com/docs/commands/overview/) and the [cheat sheet](https://zb-connector.com/docs/commands/cheatsheet/)
-   [long](https://zb-connector.com/docs/commands/long/): open a buy (long) market position
