Every JSON message template you need for TradingView webhook automation. Buy, sell, close, scale in — all copy-paste ready for Traders Post and compatible tools.
When TradingView fires a webhook alert, it sends the content of the alert's Message box to your automation software's URL. That software (Traders Post, AutoView etc.) needs to understand what action to take — buy, sell, which instrument, how many lots.
JSON (JavaScript Object Notation) is a structured data format that automation software can read reliably. Think of it as a precisely formatted instruction note. The structure must be exact — a missing quote or misplaced comma will cause the message to fail.
| Field | Purpose | Common Values |
|---|---|---|
| "ticker" | The instrument to trade. Use {{ticker}} to auto-fill from chart | "EURUSD" or "{{ticker}}" |
| "action" | Trade direction | "buy" / "sell" / "close" |
| "order_type" | Market or limit order | "market" / "limit" |
| "quantity" | Lot size or number of contracts | 0.5 / 1 / 2 |
| "price" | Limit order price (limit orders only) | {{close}} or specific price |
| "stop_loss" | Stop loss price or pips offset | "{{close}} - 0.0030" |
| "take_profit" | Take profit price or pips offset | "{{close}} + 0.0060" |
| "comment" | Trade identifier — shows in MT4/MT5 trade comment | "VWAP_LONG_{{timenow}}" |
{
"ticker": "{{ticker}}",
"action": "buy",
"order_type": "market",
"quantity": 1,
"comment": "BUY_{{timenow}}"
}
{
"ticker": "{{ticker}}",
"action": "sell",
"order_type": "market",
"quantity": 1,
"comment": "SELL_{{timenow}}"
}
{
"ticker": "{{ticker}}",
"action": "buy",
"order_type": "market",
"quantity": 1,
"stop_loss": 30,
"take_profit": 60,
"comment": "BUY_SL30_TP60"
}
{
"ticker": "{{ticker}}",
"action": "sell",
"order_type": "market",
"quantity": 1,
"stop_loss": 30,
"take_profit": 60,
"comment": "SELL_SL30_TP60"
}
{
"ticker": "{{ticker}}",
"action": "close",
"quantity": "100%",
"comment": "CLOSE_ALL"
}
{
"ticker": "{{ticker}}",
"action": "close",
"quantity": "50%",
"comment": "PARTIAL_CLOSE_50"
}
{
"ticker": "{{ticker}}",
"action": "buy",
"order_type": "limit",
"price": "{{close}}",
"quantity": 1,
"stop_loss": 30,
"take_profit": 60,
"comment": "LIMIT_BUY"
}
{
"ticker": "{{ticker}}",
"action": "sell",
"order_type": "market",
"quantity": "200%",
"comment": "REVERSE_LONG_TO_SHORT"
}
{
"ticker": "{{ticker}}",
"action": "buy",
"order_type": "market",
"quantity": 1,
"comment": "VWAP_REV_LONG"
}
{
"ticker": "{{ticker}}",
"action": "sell",
"order_type": "market",
"quantity": 1,
"comment": "VWAP_REV_SHORT"
}
{
"ticker": "{{ticker}}",
"action": "buy",
"order_type": "market",
"quantity": 1,
"comment": "WCR_WEEKLY_LONG"
}
{
"ticker": "{{ticker}}",
"action": "sell",
"order_type": "market",
"quantity": 1,
"comment": "WCR_DAILY_SHORT"
}
{
"ticker": "{{ticker}}",
"action": "buy",
"order_type": "market",
"quantity": 1,
"comment": "LDN_BRK_LONG"
}
{
"ticker": "{{ticker}}",
"action": "sell",
"order_type": "market",
"quantity": 1,
"comment": "LDN_BRK_SHORT"
}
Before pasting a JSON message into TradingView, always validate it. Invalid JSON silently fails — Traders Post receives the message but ignores it, and no trade executes.
Quick validation rule: every opening {"} must have a closing }, every string value must be in double quotes, and the last field must NOT have a trailing comma.
"quantity": 1, on the last line'action': 'buy' — must use double quotes"quantity": "1" — numbers don't use quotes}