TradingView alert messages
A copy-paste reference for the JSON a TradingView alert should send Nyria: the single strategy message, the per-side indicator messages, every placeholder.
This is a quick reference for the message you paste into TradingView's Message box. For the full walkthrough, see Connect TradingView Alerts to Nyria.
Nyria's parser accepts any format. These are the defaults Nyria's setup wizard generates. Paste your own if you prefer; just confirm it on the strategy's Integration tab before going live.
Strategy: one "Order fills only" alert
A strategy() script fires one alert that covers every order, so you paste this once per ticker:
{
"action": "{{strategy.order.action}}",
"instrument": "{{ticker}}",
"marketPosition": "{{strategy.market_position}}",
"prevMarketPosition": "{{strategy.prev_market_position}}",
"contracts": "{{strategy.order.contracts}}",
"price": {{close}}
}Using an indicator() script instead? Convert it first with Convert an Indicator to a Strategy so one alert covers every side.
Indicator: one alert per side
An indicator() needs a separate alert per signal. Each side bakes in its own action and direction, so there are no strategy placeholders:
Long entry
{ "action": "OPEN", "instrument": "{{ticker}}", "direction": "LONG", "price": {{close}} }Long exit
{ "action": "CLOSE", "instrument": "{{ticker}}", "direction": "LONG", "price": {{close}} }Short entry
{ "action": "OPEN", "instrument": "{{ticker}}", "direction": "SHORT", "price": {{close}} }Short exit
{ "action": "CLOSE", "instrument": "{{ticker}}", "direction": "SHORT", "price": {{close}} }Placeholders
TradingView substitutes these at fire time:
| Placeholder | Resolves to | Used by |
|---|---|---|
{{ticker}} | The chart symbol (e.g. SPY) | both |
{{close}} | Confirmed bar close | both |
{{strategy.order.action}} | buy / sell | strategy |
{{strategy.market_position}} | long / short / flat after the fill | strategy |
{{strategy.prev_market_position}} | Position before the fill | strategy |
{{strategy.order.contracts}} | Order size (informational; Nyria sizes from your bot) | strategy |
{{interval}} | Chart timeframe | either |
{{time}} / {{timenow}} | Bar open time / alert fire time, UTC | either |
{{exchange}} | Data source (e.g. NASDAQ) | either |
{{plot_0}}–{{plot_19}} | Numbered plot values from the script | indicator |
Only what TradingView publishes gets replaced. Anything else between
double braces is sent to Nyria exactly as typed. A Pine variable is not an
alert placeholder: syminfo.ticker is concatenated inside alert()
('{"instrument":"' + syminfo.ticker + '"}'), while the alert dialog's
Message box takes {{ticker}}. Send {{syminfo.ticker}} and Nyria receives
those characters as the symbol, finds no such instrument, and refuses the
trade.
What's next
- Connect TradingView Alerts to Nyria: the full setup walkthrough, including Once Per Bar Close + repainting.
- Convert an Indicator to a Strategy: fold per-side alerts into one.
- Webhook Payload Reference: every field Nyria reads from the message.
Convert a TradingView Indicator to a Strategy
Turn an indicator() Pine script into a strategy() so one Order Fills Only alert covers every entry and exit, instead of an alert per signal per ticker.
Stream Discord channel alerts to Nyria
Add the Nyria bot to a Discord server, authorize a channel, and route every alert posted there into a strategy: embeds, free text and quoted-tweet calls.