Guide / Checked Oct 2026
TradingView alert placeholders
A TradingView alert placeholder is a keyword in double braces, such as {{ticker}} or {{close}}, that TradingView swaps for the live value when the alert fires. Eleven work in any alert, the strategy.* set works only in alerts on a strategy, and anything else in braces is sent as typed.
Official documentation
What is a TradingView alert placeholder?
A placeholder stands in for a value that changes from one fire to the next. You type it in the alert dialog's Message box, or in the message argument of alertcondition(), and TradingView fills it in at the moment the alert triggers. The same message then serves every bar and, with {{ticker}}, every chart you copy it to.
TradingView replaces only the placeholders it publishes. A Pine variable name in braces, such as {{syminfo.ticker}}, goes out as literal text. Inside an alert() call you need no placeholders at all, because you build the string in Pine with syminfo.ticker and str.tostring().
Which placeholders work in every alert?
| Placeholder | Becomes | Notes |
|---|---|---|
| {{ticker}} | The symbol, such as AAPL or BTCUSD | |
| {{exchange}} | The exchange, such as NASDAQ or CME | A delayed symbol's exchange ends in _DL or _DLY |
| {{close}} {{open}} {{high}} {{low}} {{volume}} | Values of the bar the alert fired on | A plain price alert is always calculated on 1-minute bars |
| {{time}} | The bar's open time in UTC, as yyyy-MM-ddTHH:mm:ssZ | |
| {{timenow}} | The fire time, same format, to the nearest second | |
| {{interval}} | The chart timeframe | Returns 1 on price alerts and on Range charts |
| {{plot_0}} to {{plot_19}} | An indicator's output series, numbered from zero | The first 20 plots only. With several indicators, the first one's values |
| {{plot("Name")}} | A plot by its title | Double quotes inside the braces, so wrap the message in single quotes. plotcandle and plotbar go by number only |
| {{syminfo.currency}} | The symbol's currency code, such as USD | |
| {{syminfo.basecurrency}} | The base currency of a pair, EUR for EURUSD | na on anything that is not a pair |
On an alertcondition() alert, the message argument must be a constant string, so placeholders are the only way to put a changing value in it. They substitute on Pine v4 and later.
Which placeholders work only in strategy alerts?
A strategy alert fires each time the broker emulator fills an order on a realtime bar. TradingView runs a copy of the strategy on its servers for the alert, and orders on historical bars send nothing. These placeholders describe the order that just filled and the position it left:
| Placeholder | Becomes |
|---|---|
| {{strategy.order.action}} | buy or sell |
| {{strategy.order.contracts}} | The number of contracts in the order |
| {{strategy.order.price}} | The fill price |
| {{strategy.order.id}} | The id string from strategy.entry(), strategy.exit() or strategy.order() |
| {{strategy.order.comment}} | The comment argument, or the id when there is none |
| {{strategy.order.alert_message}} | The alert_message argument of the order call |
| {{strategy.position_size}} | The position size after the fill, negative when short |
| {{strategy.market_position}} | long, flat or short after the fill |
| {{strategy.market_position_size}} | The position size as a positive number |
| {{strategy.prev_market_position}} | long, flat or short before the fill |
| {{strategy.prev_market_position_size}} | The size before the fill, as a positive number |
An indicator() script has none of these, because an indicator holds no position. To use alert_message, put {{strategy.order.alert_message}} in the Message field; an order call without the argument fills it with an empty string.
Which placeholders belong in a webhook message?
The service on the other end needs the symbol, the side and the position after the fill. Four placeholders carry that, and two more make the message easier to trace:
json
{
"ticker": "{{ticker}}",
"action": "{{strategy.order.action}}",
"marketPosition": "{{strategy.market_position}}",
"prevMarketPosition": "{{strategy.prev_market_position}}",
"price": {{close}},
"metadata": { "message_id": "{{timenow}}" }
}The two position fields tell the receiver what happened: flat to long is an entry, long to flat is an exit, long to short is a reversal. {{close}} records the bar price the fill was based on. {{timenow}} makes each body unique, which matters when a receiver drops repeated messages.
Leave out {{strategy.order.contracts}} unless the receiver sizes from it. Leave out plot values unless something reads them. Plain text takes placeholders too: {{strategy.order.action}} {{ticker}} at {{close}} goes out as buy SPY at 771.2.
Why did my alert send {{syminfo.ticker}} as text?
Because syminfo.ticker is a Pine variable, not a published placeholder. TradingView passes unknown braces through untouched, and the receiver gets {{syminfo.ticker}} where it expected a symbol.
The two contexts use different tools. In the alert dialog's Message box, write {{ticker}}. Inside an alert() call, join the value into the string: alert('{"ticker":"' + syminfo.ticker + '"}'). Mix them and the braces survive the trip.
How Nyria reads them
Nyria writes the alert message for you. For a strategy() script it is one Order fills only alert per ticker, carrying {{strategy.order.action}}, {{ticker}}, {{strategy.market_position}}, {{strategy.prev_market_position}}, {{strategy.order.contracts}} and {{close}}. Send the two position fields and Nyria works out the action and direction from the change. The contract count is reference only, since each bot sizes from its own budget per entry. Alert to order, sub-second.
An indicator() gets one message per side, with the action and direction spelled out, because it has no strategy placeholders. Nyria's docs also show how to convert the indicator to a strategy so one alert covers every side. A placeholder that arrives with its braces shows on the Logs tab as a refused symbol, and the fix is in the alert message. Check format on the Integration tab reads a sample before anything trades.
The alert tester shows how a message will be read before anything trades.
Questions
- Can I use placeholders inside an alert() call?
- No. alert() takes a string you build in Pine, so use syminfo.ticker and str.tostring() there. Placeholders belong in the alert dialog's Message box and in alertcondition() messages.
- Why does {{interval}} return 1?
- Price alerts and Range charts are calculated on 1-minute data, so the placeholder returns 1 there. On an alert created from an indicator or a drawing it returns the chart's timeframe.
- What does {{strategy.market_position}} say on a reversal?
- short, with {{strategy.prev_market_position}} reading long. The one fill that closed the long and opened the short fires one alert with both values.
- Do placeholders work in a plain text message?
- Yes. TradingView fills them in wherever they appear and sends the message as written. JSON is only needed when the receiver asks for it.
- Why is {{plot_0}} showing the wrong indicator's value?
- With several indicators on the chart, the plot placeholders take values from the first one. Select the indicator you want in the alert dialog's first dropdown.
- What does it cost?
- Paper is free. Live trading from $15 a month.
Guides
Automate TradingView alerts to your broker
The alert, the webhook URL, the message, a paper test, then live.
What is a webhook in trading?
A URL a program posts to. A TradingView example, what the message needs and why the URL is secret.
TradingView webhook JSON format
TradingView sends the Message box as written. What it adds, and what Nyria needs the message to say.
Why is my TradingView webhook not firing?
Six checks, most common first, ending at the logged reason.
Test your alert message on paper
Trade and test free on paper. No card required.