Loading page…
Loading page…
Test {{ticker}}, {{close}}, and {{strategy.order.*}} alert placeholders live with automatic JSON quoting validation and copyable snippets.
Edit a TradingView alert message template on the left to preview the exact HTTP POST body and catch unquoted string bugs before deploying.
{
"secret": "wh_live_9x82a",
"exchange": "BINANCE",
"ticker": "BTCUSDT.P",
"timeframe": "15",
"action": "buy",
"contracts": 0.25,
"price": 92450.5,
"position": "long",
"position_size": 0.25,
"timestamp": "2026-11-23T03:30:01Z"
}Content-Type: application/json; charset=utf-8 when the rendered message parses as JSON.{{ticker}} and {{strategy.order.action}} MUST be enclosed in double quotes inside JSON.| Placeholder | Substituted Output | JSON Quoting & Scope | Copy |
|---|---|---|---|
| {{ticker}} | Symbol ticker without exchange prefix (e.g. BTCUSDT.P, AAPL). | String — MUST quote: "{{ticker}}" | |
| {{exchange}} | Exchange venue code (e.g. BINANCE, NASDAQ, CME_MINI). | String — MUST quote: "{{exchange}}" | |
| {{close}} | Current bar close price at alert trigger time (numeric). | Number — unquoted in JSON: {{close}} | |
| {{open}} / {{high}} / {{low}} / {{volume}} | Current bar open, high, low prices and volume (numeric). | Number — unquoted in JSON | |
| {{interval}} | Chart timeframe resolution (e.g. 15, 60, 1D, 1W). | String — MUST quote ("1D" breaks unquoted) | |
| {{time}} | Bar open timestamp in UTC ISO-8601 (e.g. 2026-11-23T03:30:00Z). | String — MUST quote: "{{time}}" | |
| {{timenow}} | Exact server dispatch UTC timestamp down to the second. | String — MUST quote: "{{timenow}}" | |
| {{strategy.order.action}} | Executed order direction: returns "buy" or "sell". | String — MUST quote (strategy() only) | |
| {{strategy.order.contracts}} | Number of contracts/shares/units filled in the order. | Number — unquoted (strategy() only) | |
| {{strategy.order.price}} | Exact broker-emulated fill price of the strategy order. | Number — unquoted (strategy() only) | |
| {{strategy.position_size}} | Signed net position after fill (positive = long, negative = short, 0 = flat). | Number — unquoted (strategy() only) | |
| {{strategy.market_position}} | Current net market side: "long", "short", or "flat". | String — MUST quote (strategy() only) | |
| {{strategy.order.alert_message}} | Injects the exact alert_message string passed to strategy.entry/exit/close. | Raw string — do NOT wrap in quotes if alert_message is already JSON | |
| {{plot_0}} ... {{plot_19}} | Value of the Nth plot() call in source order (0-indexed, max 20 plots). | Number — breaks if plot() order changes; use plot('name') or alert() instead |
1//@version=62strategy("Custom JSON via {{strategy.order.alert_message}}", overlay = true)3 4atrVal = ta.atr(14)5longCond = ta.crossover(ta.ema(close, 21), ta.ema(close, 55))6 7if longCond and strategy.position_size == 08 float slPrice = close - atrVal * 2.09 float tpPrice = close + atrVal * 3.510 // Put ONLY {{strategy.order.alert_message}} in the TradingView Alert Message box11 string jsonBody =12 '{"ticker":"' + syminfo.ticker +13 '","action":"buy","entry":' + str.tostring(close) +14 ',"stop_loss":' + str.tostring(slPrice, format.mintick) +15 ',"take_profit":' + str.tostring(tpPrice, format.mintick) + '}'16 strategy.entry("Long", strategy.long, alert_message = jsonBody)17 18plot(ta.ema(close, 21), "EMA 21", color = color.new(#2962ff, 0))