Pine Script strategy alerts for Autoview
If you've followed the automate TradingView alerts guide, you've already hand-written a command like s=BTCUSDT b=buy q=1 t=market into an alert's message box. That works fine for a fixed alert. A Pine Script strategy() is different: its buy/sell side and its size can change bar to bar, so a hard-coded message goes stale the moment your logic does. This page covers the other path: having TradingView fill the command in for you.
The piece that makes this work: strategy placeholders
TradingView's alert message box accepts placeholders wrapped in double braces, and it substitutes the real value the instant the alert fires. These are TradingView's substitutions, not Autoview's. Autoview only ever sees the final text after TradingView has already filled it in. Two matter here:
{{strategy.order.action}}resolves tobuyorsell, lowercase, for whichever order yourstrategy.entry()/strategy.close()call just placed.{{strategy.order.contracts}}resolves to the size of that same order, as a plain number.
Autoview's parser lowercases every value it reads before matching it, so buy/sell land correctly either way. Drop them straight into the command in place of the values you'd otherwise type by hand:
s=BTCUSDT b={{strategy.order.action}} q={{strategy.order.contracts}} t=marketSet this as the alert's message when you create the alert with condition Any alert() function call on your strategy. Every time the strategy enters or exits a position, TradingView fires the alert with that message, already filled in for the trade that just happened, and posts it to your Autoview webhook.
Symbol still needs a human check
TradingView also offers {{ticker}} for the instrument, but don't reach for it automatically. It returns the exchange's raw concatenated symbol, and that format doesn't match every exchange Autoview supports. OANDA is the sharp case: {{ticker}} returns EURUSD, but Autoview's OANDA parser requires the underscored form, EUR_USD. A command built from {{ticker}} against a forex chart fails silently at the exchange, not at Autoview. Safer default: hardcode s= to the exact symbol your webhook is meant to trade, and only reach for a dynamic ticker once you've confirmed the resolved format matches what your specific exchange expects. The command reference lists the format per exchange.
Layer on risk management the same way
Once the entry/exit side and size are wired up, the rest of the command works exactly like a hand-written one. Stops, targets, and trailing stops attach with the same parameters covered in stops, targets, and trailing, and if your strategy needs to pass a value through that Pine Script computes at the time of the signal (a level, a distance, anything numeric), the custom variables page covers plugging that into the equation side of a parameter without touching the strategy code that generates the alert.
Test before you trust it
A strategy alert is still a webhook post, so the same rule applies: dry-run first. Add d=1 to the message, let a few signals fire, and read the log. Did the side and size match what your strategy just did? Did the symbol resolve the way you expected? Confirm both before removing d=1. The automate TradingView alerts guide's dry-run step covers the full round trip if you haven't run through it yet.
A note on what Autoview is. Autoview is an execution tool, not a trading or investment advisor. It places the orders your own strategy and alerts tell it to; it doesn't generate signals or make any claim about results. Trading carries risk of loss, and you're responsible for the strategy you automate. See our disclosures.