FREE TOOL

How do I write a TradingView webhook alert message in JSON?

Put one JSON object in the alert's Message box with at least a symbol and an action, for example "symbol": "{{ticker}}" and "action": "buy". For a Pine strategy, also send {{strategy.market_position}}, because an exit sends "sell" too. The generator below builds this message for you, and the validator checks one you already have.

Nothing you type here is sent anywhere: the generator and the validator run entirely in your browser.

Generator

Market
Alert type

You choose the direction. Each alert sends one direction; to close, set up a separate alert.

Direction
Symbol
Stop-loss / take-profit

Prices only. Percentage-based stop-loss and take-profit are set in your bot settings, not in the alert.

Leverage
Margin type
Order size
Trailing stop and breakeven
Trailing stop
Move stop-loss to entry

Alert message


Validator

Paste an alert message to see which fields AlgoVesta reads, which it ignores, and what would go wrong.

  • Results appear here.

How to use it

  1. Choose the market, the alert type and the symbol. For a Pine strategy, pick "Pine strategy" so the position fields are included.
  2. Add stop-loss and take-profit if your alert should carry them; otherwise your bot settings apply.
  3. Copy the JSON and paste it into the Message box of the TradingView alert.
  4. In the alert's Notifications tab, turn on Webhook URL and paste the address from your AlgoVesta strategy. TradingView shows this field only with two-factor authentication enabled and a paid plan.
  5. Before going live, paste the final message into the validator, or send a test signal from your panel.

Run this alert automatically

Paste your AlgoVesta webhook address into the alert and the same message opens and closes orders on your connected exchange or MetaTrader 5 account, with your stop-loss and size rules applied. Start in paper mode if you prefer.

Start 7-day free trial

No credit card required.

FAQ

Your Questions,
Answered

The most common questions before you decide — if you still have doubts, start here.

{{strategy.order.action}} sends "sell" both when a long is closed and when a short is opened. If the message has only that field, the exit looks like a new SHORT. Add "market_position": "{{strategy.market_position}}" and "prev_market_position": "{{strategy.prev_market_position}}": when the position becomes flat, AlgoVesta closes it instead.
No. TradingView does not let you add custom HTTP headers to a webhook, so a signature header never arrives. AlgoVesta checks that the request comes from TradingView's published webhook IP addresses or from your own allowlist; keep your webhook address private, because it works like a password.
TradingView shows the Webhook URL option only after two-factor authentication is enabled on your account, and webhooks need a paid TradingView plan.
It is the margin committed to the trade, not the position value. With 10x leverage, "amount_usd": 100 opens a position worth about 1,000 USD. Use risk_percent if you want the size to follow your stop-loss distance.
No. The target exchange or MetaTrader 5 account is chosen in the strategy settings in your panel, so AlgoVesta ignores an "exchange" field in the alert.
No. The generator and the validator are plain JavaScript running in your browser; the message is not uploaded or stored.

Last reviewed: 11 November 2026