Skip to content
Nyria Docs
Set up your sourceTradingView

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:

PlaceholderResolves toUsed by
{{ticker}}The chart symbol (e.g. SPY)both
{{close}}Confirmed bar closeboth
{{strategy.order.action}}buy / sellstrategy
{{strategy.market_position}}long / short / flat after the fillstrategy
{{strategy.prev_market_position}}Position before the fillstrategy
{{strategy.order.contracts}}Order size (informational; Nyria sizes from your bot)strategy
{{interval}}Chart timeframeeither
{{time}} / {{timenow}}Bar open time / alert fire time, UTCeither
{{exchange}}Data source (e.g. NASDAQ)either
{{plot_0}}{{plot_19}}Numbered plot values from the scriptindicator

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