TradingView webhook message format: JSON and placeholders explained
By the BotEdge team · · 8 min read
Short answer
A TradingView webhook is an HTTP POST whose body is your alert message. Write the message as valid JSON and TradingView sends it as application/json; put placeholders such as {{strategy.order.action}} inside it and TradingView fills them in when the alert fires. For BotEdge, the message needs your pointer, the ticker, the action and the quantity.
Key facts
- The webhook body is exactly the text in the alert's Message box, after placeholders are replaced.
- Valid JSON is sent as
application/json; anything else is sent astext/plain. - TradingView cancels a webhook request that takes longer than three seconds, and only sends webhooks from accounts with two-factor authentication.
{{strategy.order.action}}becomesbuyorsell;{{strategy.order.contracts}}becomes the order size the strategy executed.- One invalid character, such as a curly quote or a trailing comma, turns the whole message into plain text that an execution service cannot read.
What TradingView sends to a webhook
When an alert fires and Webhook URL is ticked in its notifications, TradingView makes an HTTP POST request to that URL. The request body is the alert message, with every placeholder already replaced by its value at that moment.
- If the message is valid JSON, the request has the header
Content-Type: application/json. Otherwise it istext/plain. - URLs with an explicit port must use 80 or 443; other ports are refused.
- The receiving server has three seconds to answer, or TradingView cancels the request.
- Webhooks are only sent from accounts with two-factor authentication turned on, and they need a TradingView plan that includes webhook notifications.
The BotEdge alert message, field by field
BotEdge reads a small JSON object. Four fields cover most strategies; the others are optional. The full reference is in the TradingView alerts docs.
| Field | Required | Value | What it does |
|---|---|---|---|
pointer | Yes | Your connection's 20-character pointer | Picks the exchange account that places the order |
ticker | Yes | {{ticker}} or a symbol such as BTCUSDT | The market. .P and PERP suffixes are ignored |
action | Unless closeall | buy or sell | The order side |
quantity | For orders | A number such as 0.01 | The order size, in the unit the exchange uses |
prev_position | No | flat, long or short | Makes closing orders reduce-only on Binance futures, Bybit, Bitget, BitMart Futures and Hyperliquid |
closeall | No | "true" | Closes the open position on the ticker instead of placing an order |
type and price | No | limit and a price | Places a limit order instead of a market order |
takeprofit, stoploss | No | Prices | Attaches exits on the exchanges that support them |
Placeholders that fill the message
TradingView replaces any {{...}} variable it knows when the alert fires. The ones that matter for automated orders:
| Placeholder | Becomes | Use it for |
|---|---|---|
{{ticker}} | The chart's symbol, for example BTCUSDT.P | The ticker field |
{{exchange}} | The chart's exchange, for example BYBIT | Checking you alerted from the right exchange |
{{strategy.order.action}} | buy or sell | The action field (strategy alerts) |
{{strategy.order.contracts}} | The size of the order the strategy executed | The quantity field (strategy alerts) |
{{strategy.prev_market_position}} | flat, long or short before the order | The prev_position field |
{{strategy.market_position}} | The position after the order | Logging and checks |
{{strategy.order.alert_message}} | The alert_message text set in the Pine Script order call | A different message per order |
{{close}}, {{timenow}}, {{interval}} | Price, alert time and timeframe | Your own records |
Good to know
Strategy placeholders only exist in alerts created on a strategy. In an indicator or manual alert, write the side and size yourself.
Ready-made messages you can copy
Strategy alert (the one your BotEdge connection card gives you, with your pointer in it). Create the alert on the strategy with "Order fills only":
{
"pointer": "YOUR_POINTER_HERE___",
"ticker": "{{ticker}}",
"action": "{{strategy.order.action}}",
"quantity": "{{strategy.order.contracts}}",
"prev_position": "{{strategy.prev_market_position}}"
}Indicator or manual alert, one alert to buy and one to sell:
{
"pointer": "YOUR_POINTER_HERE___",
"ticker": "{{ticker}}",
"action": "buy",
"quantity": "0.01"
}{
"pointer": "YOUR_POINTER_HERE___",
"ticker": "{{ticker}}",
"action": "sell",
"quantity": "0.01"
}Close the whole position on the ticker, whatever its size and side:
{
"pointer": "YOUR_POINTER_HERE___",
"ticker": "{{ticker}}",
"closeall": "true"
}Limit order with take-profit and stop-loss, on an exchange that supports them:
{
"pointer": "YOUR_POINTER_HERE___",
"ticker": "BTCUSDT",
"action": "buy",
"quantity": "0.01",
"type": "limit",
"price": "60000",
"takeprofit": "66000",
"stoploss": "57000"
}Advanced: a different message for each order
A strategy can attach its own text to each order with the alert_message argument of strategy.entry, strategy.exit, strategy.order or strategy.close. Put only {{strategy.order.alert_message}} in the alert's Message box, and every fill sends the text that order carried:
strategy.entry("Long", strategy.long, alert_message = '{"pointer": "YOUR_POINTER_HERE___", "ticker": "BTCUSDT", "action": "buy", "quantity": "0.01", "takeprofit": "66000"}')This is useful when entries and exits need different fields, for example a take-profit on the entry only. Keep the pointer out of scripts you share: anyone holding it can trigger orders.
Mistakes that break the message
| Mistake | What happens | Fix |
|---|---|---|
| Curly quotes (“ ”) from a notes app or chat | The message is not JSON any more and arrives as plain text | Type straight quotes (") or paste the message from your dashboard |
| A trailing comma after the last field | Invalid JSON | Remove the comma before } |
Comments such as // buy | Invalid JSON: JSON has no comments | Delete them |
closeall sent as true without quotes | The field is not recognized as intended | Write "closeall": "true" |
| Alerting from another exchange's chart | {{ticker}} names a market your exchange may not list | Alert from the chart of the exchange you connected |
| Alerting from a dated futures chart | {{ticker}} sends a contract like BTCUSDZ2026 | Use the spot or perpetual chart, or write the ticker: "ticker": "BTCUSDT" |
| Missing or old pointer | The alert reaches no connection | Copy the message again from the connection card |
When an order fails anyway, the email you receive and the trading journal in your dashboard give the exchange's reason; the error guide explains the fix.
Frequently asked questions
- Does a TradingView webhook message have to be JSON?
- TradingView sends any text. Valid JSON is sent as application/json and everything else as text/plain. Execution services such as BotEdge read JSON fields, so the message must be valid JSON for an order to be placed.
- What does {{strategy.order.action}} return?
- The side of the order the strategy just executed: buy or sell. It only exists in alerts created on a strategy, not on indicators.
- Why does my ticker end in .P?
- TradingView marks perpetual futures charts with .P, for example BTCUSDT.P. BotEdge ignores the .P and PERP suffixes and uses the matching market on your exchange.
- Can I use the same message for several strategies?
- Yes. The pointer picks the exchange account and {{ticker}} picks the market, so the same message works on every chart of that exchange. Use a different connection, and so a different pointer, for each account.
- Is it safe to put my pointer in the alert message?
- The message is only sent to the webhook URL you set, but anyone who sees the pointer can trigger orders. Never post it publicly, and generate a new pointer from the dashboard if it leaks.
Sources
- TradingView: How to configure webhook alerts checked November 15, 2026
- TradingView: How to use a variable value in alert checked November 16, 2026
- TradingView: Strategy alerts checked November 15, 2026