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
You choose the direction. Each alert sends one direction; to close, set up a separate alert.
Create the alert with "Order fills only". Entries, exits and reversals are detected from the position fields.
Prices only. Percentage-based stop-loss and take-profit are set in your bot settings, not in the alert.
USD means the margin you commit, not the position value (position value = margin x leverage).
Trailing stop and breakeven
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
- Choose the market, the alert type and the symbol. For a Pine strategy, pick "Pine strategy" so the position fields are included.
- Add stop-loss and take-profit if your alert should carry them; otherwise your bot settings apply.
- Copy the JSON and paste it into the Message box of the TradingView alert.
- 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.
- 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 trialNo credit card required.
Your Questions,
Answered
The most common questions before you decide — if you still have doubts, start here.