# TradingView placeholders in alert messages

> TradingView placeholders you can use in a ZB Connector alert message, what each one returns, and the unit and naming pitfalls to avoid.

Source: https://zb-connector.com/docs/tradingview/placeholders/

TradingView replaces a placeholder written in double braces, such as `{{ticker}}`, with a value when the alert fires. This page lists the placeholders and what ZB Connector needs from them. The full list is in [TradingView’s own guide](https://www.tradingview.com/support/solutions/43000531021-how-to-use-a-variable-value-in-alert/).

**The rule to remember:** ZB Connector reads `volume` as **lots** and `action` as one of its own command names. TradingView values in other units, or with other names, must not be passed through unchanged.

## Basic placeholders

| Placeholder | What TradingView returns | What to check for ZB Connector |
| --- | --- | --- |
| `{{ticker}}` | The ticker of the symbol of the alert | Your broker’s MT5 symbol must match what you send exactly. If your broker adds a prefix or suffix, set the EA’s **Symbol prefix** / **Symbol suffix** inputs or write the symbol yourself. |
| `{{exchange}}` | The exchange of the symbol | Not needed for a command. |
| `{{close}}`, `{{open}}`, `{{high}}`, `{{low}}` | The values of the bar on which the alert triggered | Price levels. They suit `sl` and `tp` only where a price level is the right unit: the EA reads `sl` and `tp` as price levels by default, or as distances if its **Stop level mode** input is pips or ticks. |
| `{{volume}}` | The volume of the bar on which the alert triggered | The trading volume of the bar. It is not your order size. Do not use it as `volume`. |
| `{{time}}` | The bar time, UTC, as `yyyy-MM-ddTHH:mm:ssZ` | Not a field of any command. |
| `{{timenow}}` | The time the alert fired, in the same format | Not a field of any command. |
| `{{interval}}` | The timeframe of the chart | Not a field of any command. |

## Strategy placeholders

Available when the alert is created on a strategy.

| Placeholder | What TradingView returns | What to check for ZB Connector |
| --- | --- | --- |
| `{{strategy.order.action}}` | The string `buy` or `sell` | These are not command names. `"action": "{{strategy.order.action}}"` is refused with HTTP 422 because `buy` is not a command. Write the action yourself, or build the message in your Pine script. |
| `{{strategy.order.contracts}}` | The number of contracts of the executed order | **Contracts are not lots.** Do not send this as `volume` unless you know the conversion for your symbol. |
| `{{strategy.order.price}}` | The price of the executed order | A price level. |
| `{{strategy.position_size}}` | The size of the current position, as in Pine | Strategy units, not lots. |
| `{{strategy.market_position}}` | The strategy’s position as text: `long`, `flat` or `short` | `flat` is not a command. Do not use it as `action`. |
| `{{strategy.order.alert_message}}` | The `alert_message` of the order in your Pine code | Put the complete JSON message in `alert_message` and use this placeholder as the whole alert message, so your Pine script controls the message. |

## Quotes and JSON

-   Text values stay in quotes: `"symbol": "{{ticker}}"`.
-   `positionID` must be text, so keep it in quotes, for example `"positionID": "{{strategy.order.id}}"`. A bare number is rejected.
-   Number fields also accept numeric text such as `"0.01"`.
-   After TradingView replaces the placeholders, the result must be one valid JSON object. If it is not, the webhook answers HTTP 400. Check the **Webhook status** in TradingView’s alert log after the first run.

## Related

-   [Create a TradingView alert](https://zb-connector.com/docs/tradingview/alert-basics/)
-   [Commands overview](https://zb-connector.com/docs/commands/overview/)
