TradingView alerts

TradingView alert message templates for webhooks

What you type in a TradingView alert's Message box is what the webhook carries. Written as a short list of labelled values, it can be filtered, reworded and sent anywhere. These are messages you can paste as they are.

Two kinds of double braces

Both TradingView and webhook.stream mark a blank to fill in with double braces, and they do it at different moments.

Looks likeFilled in byWhen
In TradingView's Message box{{ticker}}, {{close}}TradingViewAs the alert fires, before it is sent
In a webhook.stream template{{body.ticker}}, {{raw}}webhook.streamAs the alert arrives, to build your Telegram or Discord message

So "price": "{{close}}" in TradingView becomes "price": "67250.5" on the way out, and {{body.price}} in your template reads that value on the way in.

A price or drawing alert

Paste into TradingView's Message box
{
  "ticker": "{{ticker}}",
  "exchange": "{{exchange}}",
  "price": "{{close}}",
  "interval": "{{interval}}",
  "time": "{{timenow}}",
  "signal": "buy"
}

Change buy to whatever this alert means to you: sell, breakout, stop hit. A template that turns it into a message:

webhook.stream template, for Telegram
{
  "chat_id": "YOUR_CHAT_ID",
  "text": "{{body.signal | upper}} {{body.ticker}} at {{body.price}}\n{{body.exchange}} · timeframe {{body.interval}}"
}

An indicator alert, with the indicator's values

Paste into TradingView's Message box
{
  "ticker": "{{ticker}}",
  "price": "{{close}}",
  "rsi": "{{plot_0}}",
  "interval": "{{interval}}"
}

{{plot_0}} is the first line the indicator draws, {{plot_1}} the second, and so on. Name them whatever is useful. To hear only about the extremes, add a condition to the automation:

FieldOperatorValue
body.rsiis less than30
webhook.stream template, for Discord
{
  "content": "{{body.ticker}} RSI is {{body.rsi}} on the {{body.interval}} timeframe. Price {{body.price}}"
}

A strategy alert, with the order

Paste into TradingView's Message box
{
  "ticker": "{{ticker}}",
  "action": "{{strategy.order.action}}",
  "contracts": "{{strategy.order.contracts}}",
  "price": "{{strategy.order.price}}",
  "position": "{{strategy.market_position}}",
  "comment": "{{strategy.order.comment}}",
  "time": "{{timenow}}"
}

One alert on the strategy then covers every order it places, because the action is filled in each time.

webhook.stream template, for Telegram
{
  "chat_id": "YOUR_CHAT_ID",
  "text": "{{body.action | upper}} {{body.contracts}} {{body.ticker}} at {{body.price}}\nPosition now: {{body.position}}\n{{body.comment}}"
}

To send entries and exits to different places, use conditions on body.action or body.position:

FieldOperatorValue
body.actionequalsbuy

Plain words work too

You do not have to use labelled values. A message such as {{ticker}} crossed {{close}} is sent as plain text, and {{raw}} in a template passes it on as written. You can still filter on it with a condition such as raw contains BTC. What you give up is picking out one value on its own.

TradingView's placeholders

PlaceholderBecomes
{{ticker}}The symbol, such as BTCUSDT
{{exchange}}The exchange, such as BINANCE
{{close}}, {{open}}, {{high}}, {{low}}, {{volume}}The values of the bar the alert fired on
{{time}}The time of that bar, in UTC
{{timenow}}The moment the alert fired, in UTC
{{interval}}The chart's timeframe, such as 15 or D
{{plot_0}} to {{plot_19}}The values an indicator draws, in order
{{plot("RSI")}}An indicator value, by the name of its line
{{syminfo.currency}}, {{syminfo.basecurrency}}The currency the symbol is priced in, and the base currency of a pair

These only work in alerts on a strategy:

PlaceholderBecomes
{{strategy.order.action}}buy or sell
{{strategy.order.contracts}}The size of the order
{{strategy.order.price}}The price the order was filled at
{{strategy.order.id}}, {{strategy.order.comment}}The order's ID and its comment
{{strategy.order.alert_message}}The alert message set in the strategy's own script
{{strategy.market_position}}, {{strategy.prev_market_position}}long, short or flat, now and before this order
{{strategy.position_size}}, {{strategy.market_position_size}}The size of the position after this order

Three rules that keep a message valid

  1. Put every value in quotation marks, numbers included.
  2. End every line with a comma except the last one.
  3. Use straight quotation marks. Text copied from a document or a chat app often has curly ones, which do not count.

If a message is not valid, TradingView sends it as plain text. To see which you are getting, send the alert to a test URL and look at it.

Try one

Get a URL, paste it and one of these messages into an alert, and fire it. The inspector shows the values as they arrived, and the automation editor previews your Telegram or Discord message against that real alert.

Free. No signup. You stay on this page.

Questions

Because it never breaks. A number without quotation marks is fine until a placeholder comes back empty, and then the whole message stops being valid JSON and TradingView sends it as plain text. Quoted values still compare as numbers in conditions.

They belong to different steps. {{close}} is a TradingView placeholder: TradingView replaces it with the price before sending. {{body.price}} is a webhook.stream placeholder: it reads the value called price from the alert that arrived.

Yes. Anything that is not a placeholder is sent as written, so you can add a line such as "signal": "buy" or "strategy": "Breakout 15m" to label the alert.

No. Placeholders that start with strategy only work in alerts created on a strategy. In other alerts they are sent as written.

webhook.stream is an independent service. It is not affiliated with or endorsed by TradingView, Telegram or Discord. Nothing on this page is financial advice.