Skip to content

Blog · TradingView · Article · updated 2026-09-25

TradingView webhook JSON explained: every placeholder you can use

What a TradingView webhook message is, which {{placeholders}} TradingView fills in, which variables TensorTrader adds, and a working JSON template for automated orders.

What a webhook message is

When a TradingView alert fires, it can send an HTTP POST request to a URL you choose. The body of that request is the alert's message: plain text you type in the alert dialog. If the text is valid JSON, a receiving service can read it as structured fields. TradingView replaces placeholders in double curly braces, such as {{ticker}} or {{close}}, with live values at the moment the alert fires.

That is the whole mechanism. TradingView does not know what an order is; it sends text. Everything about which exchange, which side, how much and at what leverage is decided by the message you write and the service that receives it.

TradingView placeholders

{{ticker}}
The symbol, for example BTCUSDT.P
{{exchange}}
The chart’s data exchange, for example BINANCE
{{open}} {{high}} {{low}} {{close}}
Prices of the bar that triggered the alert
{{volume}}
Volume of that bar
{{time}} / {{timenow}}
Bar time / the moment the alert fired
{{interval}}
The chart timeframe, for example 15 or 240
{{syminfo.currency}} / {{syminfo.basecurrency}}
Quote and base currency
{{plot_0}} … {{plot_19}}, {{plot("Name")}}
Values of an indicator’s plots
{{strategy.order.action}}
buy or sell, on strategy alerts
{{strategy.market_position}}
long, short or flat after the fill, on strategy alerts

TensorTrader variables

The TensorTrader extension adds its own variables, written {{tt.*}}. Unlike TradingView placeholders, these are rendered by the extension when it creates each alert, so every alert gets its own values baked in: the webhook secret, the action, the exchange and key, margin, size, leverage mode and cap, risk mode, and identity keys that let TensorTrader match fills to the alert that caused them.

{{tt.secret}}
Your webhook secret; required on every message
{{tt.action}}
open_long, open_short or the strategy mapping
{{tt.exchange}} / {{tt.exchange_key_id}}
Which venue and which of your keys
{{tt.margin_usd}} / {{tt.size_usd}}
Per-alert margin and default order size
{{tt.leverage}} / {{tt.lev_mode}} / {{tt.lev_base}} / {{tt.lev_cap}}
Leverage, or the breadth-scaling base and cap
{{tt.risk_mode}}
Who owns stops and targets
{{tt.def_key}} / {{tt.alert_key}}
Identity keys for attribution

A working template

In the extension's Webhook payload card, Guided TensorTrader JSON builds this for you. Advanced custom JSON lets you edit it: the wizard validates the JSON, shows its length, keeps TradingView placeholders intact and renders the {{tt.*}} variables per alert. The extension offers clickable placeholder chips for each group so you do not have to remember the names.

{
  "secret": "{{tt.secret}}",
  "a": "{{tt.action}}",
  "sym": "{{ticker}}",
  "tf": "{{interval}}",
  "px": "{{close}}",
  "exchange": "{{tt.exchange}}",
  "exk": "{{tt.exchange_key_id}}",
  "m": "{{tt.margin_usd}}",
  "lev_mode": "{{tt.lev_mode}}",
  "lev_base": "{{tt.lev_base}}",
  "lev_cap": "{{tt.lev_cap}}"
}

Security: the secret is the whole game

Anyone who knows your webhook URL and secret can send orders to your account. Keep the secret out of public scripts, screenshots and shared chart layouts. If it leaks, rotate it in TensorTrader; existing alerts must then be recreated with the new secret, which Batch Create does in one run. TensorTrader also validates every field against an allow-list, so an attacker cannot smuggle unexpected keys through a message.

Common JSON mistakes

smart quotes
Copying from a document can turn " into curly quotes, which is invalid JSON.
trailing commas
A comma after the last field breaks strict JSON parsers.
unquoted placeholders
Wrap placeholders in quotes so an empty value still yields valid JSON.
message too long
Keep messages compact; the extension shows the character count.

Testing a message before you rely on it

Fire the alert once on a testnet key and check TensorTrader's Received signals list in the TradingView tab. If the entry shows "command accepted", the JSON parsed and the secret matched. If the list is empty, the webhook never arrived: check the URL and that the alert is active.

Frequently asked questions

Does TradingView send JSON automatically?
No. It sends whatever text you write. If you write valid JSON, the receiver can parse it.
Which TradingView plans support webhooks?
Webhook URLs require a paid TradingView plan.
Can I use plot values in the message?
Yes: {{plot_0}} to {{plot_19}} or {{plot("Name")}} insert an indicator’s plotted values.

Keep reading

Not financial advice. Performance figures are TensorTrader testnet or backtest results with the method stated; past results do not predict future returns.

All guides · Start on paper · Pricing