Nyria Docs
Alert sourcesTradingView

TradingView alert messages

A copy-paste reference for the JSON Nyria expects in a TradingView alert — the single strategy message, the per-side indicator messages, and 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 — 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

What's next