New

Complete Suite: all 11 tools. 5 new Premium desks inside.All 11 tools $557.98 one by one

$557.98 one by one $97 once Save $460.98Get the SuiteGet it

TradingView webhook JSON builder

Build a webhook message from TradingView's placeholders and see as you type if it goes out as JSON.

Updated 23 October 2026. Runs in your browser; nothing you type is uploaded.

Sample alert messageSent as application/json

Send to

Alert from

Placeholders for any alert

Strategy alerts only

Text placeholders go in quotes; a placeholder added outside a string comes with them.

Your own server, strategy alert

Valid JSON: TradingView sends it as application/json

Nothing to fix. This is the custom JSON preset for a strategy.

What your server receives

Content-Type: application/json, with sample values in place of the placeholders.

{
  "ticker": "NQ1!",
  "action": "buy",
  "contracts": 2,
  "price": 18342.25,
  "position": "long",
  "time": "2026-10-23T14:35:02Z"
}

Where it goes

Webhook URL
Your endpoint: TradingView posts to ports 80 and 443 only.
The secret
Wherever your server reads it. A secret in the message travels in every alert and every copy of it.
  • Your server sees the body exactly as TradingView renders it. Check Content-Type: application/json arrives only when the message is valid JSON.

Or build it in Pine, so the JSON is never inside other JSON

In the alert: Order fills only, and nothing but {{strategy.order.alert_message}} in the Message box. Each order passes the whole message as alert_message, with its own buy or sell.

//@version=6
strategy("Webhook message", overlay = true)

// Your own rules go here; this example crosses two averages.
fast = ta.sma(close, 10)
slow = ta.sma(close, 30)
qty = 1

// The whole message, built here. In the alert: Order fills only, and nothing but
// {{strategy.order.alert_message}} in the Message box.
webhookMessage(string action, string id, string position) =>
    string m = '{'
    m += '"ticker": "' + syminfo.ticker + '",'
    m += '"action": "' + action + '",'
    m += '"contracts": ' + str.tostring(qty) + ','
    m += '"price": ' + str.tostring(close) + ','
    m += '"position": "' + position + '",'
    m += '"time": "' + str.format_time(timenow, "yyyy-MM-dd'T'HH:mm:ss'Z'", "UTC") + '"'
    m += '}'
    m

if ta.crossover(fast, slow)
    strategy.entry("Long", strategy.long, qty, alert_message = webhookMessage("buy", "Long", "long"))
if ta.crossunder(fast, slow)
    strategy.entry("Short", strategy.short, qty, alert_message = webhookMessage("sell", "Short", "short"))

The code for every preset compiles on TradingView with no errors or warnings. Put your own entry rules in place of the two averages, then check the script for repaint risks.

The math: Content-Type = (message with placeholders filled is valid JSON) ? application/json : text/plain

TradingView's side of a webhook

Plan and 2FA
Webhook notifications are on Essential, Plus, Premium, Ultimate, not on the free Basic plan (pricing table), and webhook alerts are allowed only with two-factor authentication turned on.
Content-Type
application/json when the message is valid JSON, text/plain otherwise. TradingView sends a POST with the message as the body.
IP addresses to allowlist
52.89.214.238, 34.212.75.30, 54.218.53.128, 52.32.178.7. Over HTTPS TradingView also sends a client certificate for webhook-server@tradingview.com (webhook authentication).
Ports, IPv6 and time
Ports 80 and 443 only; no IPv6; no localhost or private addresses. A request your server takes more than three seconds to answer is cancelled, and a 500 to 599 answer other than 504 is sent again after 5 seconds, up to 3 times (resubmission).
Message length
4,000 characters in the alert's Message box; 40,960 from alert() or alert_message. The body has the same limits, and an emoji counts as several characters (size limits).
Secrets
TradingView asks you not to put login credentials or passwords in the webhook URL or message (credentials for webhooks).

From TradingView's How to configure webhook alerts and the pages linked above, read 23 October 2026.

TradingView's placeholders, and how to write each in JSON

TradingView fills these in when the alert fires: in the alert's Message box and in alertcondition() messages, but not inside alert(). Text goes in double quotes; a number can go bare. Placeholders with the strategy prefix work only in strategy alerts.

From TradingView's variables in alerts and strategy alerts help, read 23 October 2026
In JSONTradingView writesAlerts
"{{ticker}}"the symbol, such as AAPL or BTCUSDAny
"{{exchange}}"the exchange, such as NASDAQ or CME (delayed symbols end in _DL or _DLY)Any
{{close}}the bar's closeAny
{{open}}the bar's openAny
{{high}}the bar's highAny
{{low}}the bar's lowAny
{{volume}}the bar's volumeAny
"{{time}}"the bar's open time in UTC, such as 2019-08-27T09:56:00ZAny
"{{timenow}}"the time the alert fired, in the same form as {{time}}Any
"{{interval}}"the chart's timeframe (TradingView notes it sometimes returns 1)Any
"{{syminfo.currency}}"the symbol's currency code, such as USDAny
"{{syminfo.basecurrency}}"a currency pair's base currency, such as EUR, and na for other symbolsAny
{{plot_0}}an indicator plot's value, numbered from plot_0 to plot_19Any
{{plot("Name")}}an indicator plot's value, by its titleAny
"{{strategy.order.action}}"buy or sell, for the executed orderStrategy only
{{strategy.order.contracts}}the executed order's number of contractsStrategy only
{{strategy.order.price}}the price the order was executed atStrategy only
"{{strategy.order.id}}"the executed order's id, the first argument of strategy.entry, strategy.exit or strategy.orderStrategy only
"{{strategy.order.comment}}"the executed order's comment, or its id when it has noneStrategy only
"{{strategy.order.alert_message}}"the order call's alert_message from your scriptStrategy only
"{{strategy.market_position}}"long, flat or shortStrategy only
{{strategy.market_position_size}}the current position's size, never negativeStrategy only
"{{strategy.prev_market_position}}"the previous position: long, flat or shortStrategy only
{{strategy.prev_market_position_size}}the previous position's size, never negativeStrategy only
{{strategy.position_size}}the current position's size, as Pine's strategy.position_size (below zero when short)Strategy only

One page per receiver

Read the full guide

The four mistakes that turn JSON into text/plain

TradingView reads the message after it fills in the placeholders. If that text is valid JSON, the webhook goes out as application/json; one wrong character and the same message goes as text/plain, which a receiver that only takes JSON turns away.

  • A text placeholder outside quotes. "action": {{strategy.order.action}} arrives as "action": buy, and a bare word is not JSON. Write "action": "{{strategy.order.action}}". Numbers such as {{close}} and {{strategy.order.contracts}} can go bare. {{interval}} is text: it can read 5 on one chart and 1D on another.
  • Curly quotes. Phones, notes apps and word processors turn " into “ and ”. JSON only takes the straight one.
  • A comma after the last field. {"ticker": "{{ticker}}",} is not JSON; delete the last comma.
  • Single quotes and comments. {'ticker': '{{ticker}}'} and // note are fine in JavaScript and wrong in JSON.

The builder marks each of these on its line and column as you type, and shows the body your receiver gets with sample values in place of the placeholders.

Keep JSON out of JSON: alert_message

A strategy can write the whole message itself. Each order call, strategy.entry(), strategy.exit(), strategy.order(), strategy.close() or strategy.close_all(), takes an alert_message, and TradingView puts it wherever the alert's Message box says {{strategy.order.alert_message}}. Leave nothing else in the box: a JSON message from the script, dropped inside another JSON string, brings its own quotes and breaks the outer one.

Whether other placeholders work inside alert_message is not settled by TradingView's own docs: the Alerts guide says they cannot be used there, and the Alerts FAQ's example uses them. The Pine code this page writes builds every value in Pine (syminfo.ticker, str.tostring(close), the order's own buy or sell), so it does not depend on either. An indicator's alert() fills in no placeholders at all, so there the message is always built in Pine.

A strategy's sell is not always a short

{{strategy.order.action}} is buy or sell for the order that filled, and a sell can be the exit of a long. PineConnector warns that sending every fill as an entry can open a position you did not mean; TradersPost reads "sentiment": "{{strategy.market_position}}" (long, short or flat) as the position the signal should leave you in. Send the position along with the action, or build exits as their own messages with alert_message.

Test before you trade on it

A valid message is half of it: the receiver's settings, your symbol names and TradingView's delivery are the other half, and this page sees none of them. Send a test alert to a request inspector or your own server, read the Content-Type it arrives with, then run the bridge on a demo account. The TradingView webhook guide has a small server that logs what arrives, and the Pine Script checker reads the strategy for repaint risks before its alerts go live.

Method and privacy

Method: Runs in your browser. The message is read as JSON with each TradingView placeholder as one token, typed as text or a number from TradingView's placeholder list, then read again by a JSON parser with sample values in their place. Each receiver's rules come from its own docs; TradingView's and the receivers' pages were read on 23 October 2026. It cannot see your receiver's settings or whether an alert was delivered: send a test alert before you trade on it.

Calculations run entirely in your browser — nothing you type is uploaded. Your last numbers stay in this browser so you can pick up where you left off; Forget them clears them. A link with your numbers carries them after the # sign, which browsers do not send to servers, and the page takes them out of the address before any analytics loads. Copy and download actions save your calculation locally. The site may record coarse tool actions under its privacy policy, without inputs, results, file contents or filenames.

Common questions

What does TradingView send to a webhook URL?

A POST request with the alert's message as the body, the moment the alert fires. If the message is valid JSON the request carries Content-Type: application/json; otherwise it goes as text/plain. TradingView sends only to ports 80 and 443, does not support IPv6, and cancels a request your server takes more than three seconds to answer.

TradingView webhook alerts: setup, JSON, IPs and ports

Why does TradingView send my webhook as text/plain instead of JSON?

Because the message, with its placeholders filled in, is not valid JSON. The usual causes are a text placeholder such as {{strategy.order.action}} or {{ticker}} outside double quotes (it arrives as buy, which is not JSON on its own), curly quotes from a phone or word processor, a comma after the last field, single quotes and comments. The builder marks each one on its line.

Which TradingView plan do webhooks need?

A paid one. TradingView's pricing table ticks Webhook notifications for Essential, Plus, Premium and Ultimate and crosses it out for the free Basic plan (read 23 October 2026). Webhook alerts also need two-factor authentication turned on.

What are TradingView's webhook IP addresses?

TradingView lists four to allowlist: 52.89.214.238, 34.212.75.30, 54.218.53.128 and 52.32.178.7 (help centre, read 23 October 2026). Over HTTPS it also sends a client certificate for webhook-server@tradingview.com, which your server can check.

Can I use {{ticker}} and other placeholders inside alert() or alert_message?

Not in alert(): TradingView's Pine docs say it does not process placeholders, so write the values in Pine, with syminfo.ticker or str.tostring(close). On alert_message TradingView's own pages disagree: the Alerts guide says other placeholders cannot be used in it, while the Alerts FAQ's example uses them. Building every value in Pine works either way, and that is what this page's Pine code does.

Which placeholders work in an indicator alert?

All but the strategy ones: {{ticker}}, {{exchange}}, {{close}}, {{open}}, {{high}}, {{low}}, {{volume}}, {{time}}, {{timenow}}, {{interval}}, {{syminfo.currency}}, {{syminfo.basecurrency}}, {{plot_0}} to {{plot_19}} and {{plot("Name")}}. TradingView fills them in the alert's Message box and in alertcondition() messages; placeholders with the strategy prefix work only in strategy alerts.

How long can a TradingView webhook message be?

Up to 4,000 characters typed in the alert's Message box, and up to 40,960 when the script writes it with alert() or alert_message; the request body has the same limits. TradingView notes that an emoji counts as several characters.

Alerts that already send the message

  • Signal Desk Premium A Pine v6 desk whose alerts write the message for you, as ticket text, JSON, TradersPost or PineConnector, with a Discord and Telegram relay. $49 once.
  • Pine Fixer An AI skill pack for 45 compiler-verified Pine v6 failure classes, with a repaint clinic. $9.99 once.

Goes deeper

Limits and trading risk

These tools calculate from your inputs, supported historical records or explicitly labelled teaching examples. They do not verify a live account, predict future returns or confirm that a broker or prop-firm rule has been met. Missing costs, floating losses and changed market conditions can materially change outcomes. Trading can lose the capital committed to it; check the stated method and your account specifications.

Read the risk disclosure