# Command cheat sheet

> One-page list of every documented ZB Connector command with its required and optional fields. Print it or keep it open next to TradingView.

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

Every message needs `license` (your key) and `action`. Field names and action names are case-sensitive. `volume` is in lots; `sl` and `tp` are price levels unless the EA input **Stop level mode** says otherwise; `offset` and `trailDistance` are in pips.

Use a demo account first. A reply of HTTP 200 means the command was queued, not that it ran.

## Open positions

| Action | Required | Optional | What it does |
| --- | --- | --- | --- |
| [`long`](https://zb-connector.com/docs/commands/long/) | `symbol`, `volume` | `sl`, `tp`, `positionID` | Open a buy (long) market position |
| [`short`](https://zb-connector.com/docs/commands/short/) | `symbol`, `volume` | `sl`, `tp`, `positionID` | Open a sell (short) market position |

## Close positions

| Action | Required | Optional | What it does |
| --- | --- | --- | --- |
| [`close_percentage`](https://zb-connector.com/docs/commands/close_percentage/) | `positionID`, `percentage` | `ticket` | Close a percentage of one position |
| [`closeAll`](https://zb-connector.com/docs/commands/closeall/) | none | none | Close every open position (long and short), on all symbols |
| [`closeByID`](https://zb-connector.com/docs/commands/closebyid/) | `positionID` | `ticket` | Close the position (or positions) with a given positionID |
| [`closeByLotSize`](https://zb-connector.com/docs/commands/closebylotsize/) | `positionID`, `volume` | `ticket` | Close a given number of lots of one position |
| [`closeLong`](https://zb-connector.com/docs/commands/closelong/) | none | none | Close every open buy (long) position, on all symbols |
| [`closeShort`](https://zb-connector.com/docs/commands/closeshort/) | none | none | Close every open sell (short) position, on all symbols |
| [`closeSymbol`](https://zb-connector.com/docs/commands/closesymbol/) | `symbol` | `direction` | Close the open positions on one symbol, long, short or both |

## Change stops and trailing

| Action | Required | Optional | What it does |
| --- | --- | --- | --- |
| [`moveStops`](https://zb-connector.com/docs/commands/movestops/) | `positionID`, one of `sl` / `tp` | `ticket`, `sl`, `tp` | Change the stop loss and/or take profit of one position |
| [`moveStopsBreakeven`](https://zb-connector.com/docs/commands/movestopsbreakeven/) | `positionID` | `ticket`, `offset` | Move the stop loss of one position to its entry price, with an optional offset |
| [`setTrailingStop`](https://zb-connector.com/docs/commands/settrailingstop/) | `positionID`, `trailDistance` | `ticket` | Attach a trailing stop to one position |

More commands are documented as they are verified; the [commands overview](https://zb-connector.com/docs/commands/overview/) lists what the webhook accepts today.
