Integration GuideTradingView WebhooksJSON Payloads

TradingView Webhook Alerts Setup & JSON Guide

Connect your TradingView chart signals to automated execution bots, Discord channels, and private trading servers using webhooks and structured JSON payloads.

How to Configure TradingView Webhook Alerts

Setting up a webhook alert in TradingView takes four simple steps:

1

Add Alert Logic to Pine Script

Use alert() or alertcondition() inside your Pine Script v6 code.

2

Open the Alert Creation Dialog

Click the Clock/Alert icon in TradingView or press Alt+A.

3

Enable Webhook URL

Under Notifications, check "Webhook URL" and enter your HTTPS endpoint.

4

Set JSON Payload

Paste your structured JSON payload containing dynamic placeholders into the Message box.

Standard Strategy JSON Payload

Paste this structured JSON template into the TradingView Alert Message box for strategy orders:

JSON Payload
{
  "ticker": "{{ticker}}",
  "action": "{{strategy.order.action}}",
  "contracts": {{strategy.order.contracts}},
  "price": {{close}},
  "timeframe": "{{interval}}",
  "secret_key": "YOUR_RECEIVER_TOKEN"
}

Dynamic JSON with Pine Script v6 alert()

When you need to dynamically construct calculated prices or custom timestamps directly in code, use the Pine Script v6 alert() function:

Pine Script v6
//@version=6
indicator("Dynamic JSON Webhook Alert [Pineify]", overlay=true)

// ---------------- Inputs ----------------
int  fast_len = input.int(9, "Fast EMA")
int  slow_len = input.int(21, "Slow EMA")

fast_ema = ta.ema(close, fast_len)
slow_ema = ta.ema(close, slow_len)

plot(fast_ema, color=color.blue, title="Fast EMA")
plot(slow_ema, color=color.orange, title="Slow EMA")

// ---------------- Signal Logic ----------------
bullish_cross = ta.crossover(fast_ema, slow_ema)
bearish_cross = ta.crossunder(fast_ema, slow_ema)

// ---------------- Dynamic JSON Webhook Payload ----------------
if bullish_cross and barstate.isconfirmed
    string payload = '{"event":"BUY","symbol":"' + syminfo.ticker +
                     '","price":' + str.tostring(close, format.mintick) +
                     ',"timeframe":"' + timeframe.period +
                     '","timestamp":' + str.tostring(time) + '}'
    alert(payload, alert.freq_once_per_bar_close)

if bearish_cross and barstate.isconfirmed
    string payload = '{"event":"SELL","symbol":"' + syminfo.ticker +
                     '","price":' + str.tostring(close, format.mintick) +
                     ',"timeframe":"' + timeframe.period +
                     '","timestamp":' + str.tostring(time) + '}'
    alert(payload, alert.freq_once_per_bar_close)

Webhook Security & Product Scope

  • Never include private keys: Keep broker secret keys on your receiving server, not in TradingView.
  • Pineify Scope Boundary: Pineify generates clean Pine Script code and JSON alert logic, but does not provide webhook routing or broker order execution.
  • Barstate Confirmation: Always wrap alert triggers in barstate.isconfirmed to prevent false repainting signals mid-candle.

Frequently Asked Questions