TheConnector blog

TradingView webhook JSON: a stable payload reference

The fields of a clear, auditable TradingView webhook payload — action, symbol, account, platform, risk — with a Pine Script example and common errors.

TheConnector is a technical routing and automation tool. Strategy, broker account settings and trading risk remain under the user's control.

Why a stable schema matters

A webhook is easier to trust when the message is explicit. A stable JSON payload can be read, logged and audited months later. TheConnector uses plain JSON on purpose: no proprietary language and no hidden parsing rules.

The core fields

A minimal, useful payload describes the action and where it goes.

{
  "action": "buy",
  "symbol": "EURUSD",
  "account": "MY_ACCOUNT",
  "platform": "mt5",
  "risk": "1",
  "sl": "20",
  "tp": "40"
}

Field by field

  • action: buy, sell, or a close instruction
  • symbol: the TradingView ticker, mapped to the broker symbol by your account
  • account: which connected account should receive it
  • platform: mt4, mt5 or ctrader when you need to be explicit
  • risk: your risk unit, interpreted by your account rules
  • sl and tp: optional stop loss and take profit distances

Sending it from Pine Script

Build the JSON as a string and send it only on a confirmed condition.

//@version=5
indicator("Webhook payload", overlay=true)
longSignal = ta.crossover(ta.sma(close, 20), ta.sma(close, 50))
if longSignal and barstate.isconfirmed
    alert("{\"action\":\"buy\",\"symbol\":\"EURUSD\",\"account\":\"MY_ACCOUNT\",\"platform\":\"mt5\",\"risk\":1,\"sl\":20,\"tp\":40}", alert.freq_once_per_bar_close)

Keep it consistent

  • Use the same field names every time
  • Decide once whether numbers are quoted, and stay consistent
  • Send one alert per bar close unless the strategy is designed otherwise
  • Do not put secrets in the payload; the access key lives in the webhook URL

Common payload errors

  • Invalid JSON, such as a missing quote or a trailing comma
  • A symbol that has no broker mapping
  • A risk value that does not match the account rules
  • Several alerts on the same candle that exceed the plan quota

Risk and limits

TheConnector routes the technical instruction you send. A valid payload does not guarantee execution: broker, spread, slippage and connectivity still apply. Strategy and trading risk stay with the user, and no automation promises gains.

Your first alert goes out today.

Free account, 30 days of Elite included, no card. Nothing to cancel if it is not for you.

Hosted in France · GDPR · French-speaking support · No access to your funds