Set up TradingView webhook automation
Turn any TradingView alert or strategy into an automated order in about two minutes.
- Open Dashboard → TradingView Bot and copy your personal webhook URL
- In TradingView create an alert → Notifications tab → enable Webhook URL and paste it TradingView only shows the Webhook URL field when two-factor authentication is enabled on your TradingView account.
- Paste this JSON into the alert Message field:
{
"symbol": "{{ticker}}",
"action": "buy",
"price": "{{close}}",
"stop_loss": "{{plot_0}}",
"take_profit": "{{plot_1}}",
"leverage": 10
}
- Click Send Test Signal on the dashboard to verify, then save your alert — you're live
Don't want to write JSON by hand? The dashboard has a visual Signal Designer that generates the exact message for you — including the strategy fields below.
Using a Pine strategy() — exits are handled for you
If your alert comes from a Pine strategy with “Order fills only”, sending action on its own is not safe: {{strategy.order.action}} returns sell on an exit as well as on a short entry. Read alone, an exit would open a short instead of closing your position.
Include the position-state fields and AlgoVesta works out entry, exit and reversal from the position itself:
{
"symbol": "{{ticker}}",
"action": "{{strategy.order.action}}",
"market_position": "{{strategy.market_position}}",
"prev_market_position": "{{strategy.prev_market_position}}",
"position_size": "{{strategy.position_size}}",
"price": "{{close}}"
}
- Position becomes flat → the position is closed. No reverse order is opened.
- Position flips (long → short or short → long) → we close first, then open the new direction. If the close fails, nothing is opened.
- Position stays in the same direction → treated as an entry.
Partial exits are not supported: if your strategy scales out, the whole position is closed and the dashboard states that explicitly.
Closing a position manually
Send close as the action with the symbol. This works from any alert type — you don't need a strategy.
{
"symbol": "{{ticker}}",
"action": "close"
}
"exchange" field inside the JSON is ignored — this is deliberate, so a leaked webhook URL cannot redirect your orders.