TradingView Webhook Alerts: Setup, Syntax & Automated Execution
Set up TradingView webhook alerts for automated trading. Learn webhook configuration, alert message syntax and how to route signals to MT5 in seconds.

A TradingView webhook alert is the trigger that turns a chart signal into a live order. When your condition is met, TradingView sends a small HTTP message to a URL you specify, and if that URL belongs to a trading bridge, the message becomes a trade on MetaTrader 5 within about a second.
Get the webhook and its message format right and your automation just works. Get them wrong and you'll stare at an alert that fired while nothing happened in your terminal. This guide covers both the setup and the syntax, which is where almost every problem actually lives.
What is a TradingView webhook?
A webhook is an automated message from one app to another. In TradingView, when you attach a Webhook URL to an alert, TradingView performs an HTTP POST to that address the instant the alert triggers, carrying whatever text you put in the alert message box.
Two things make webhooks powerful for traders:
- They fire server-side, you don't need TradingView open on your machine.
- They carry a custom payload, you decide exactly what instructions to send.
That payload is the order. A bridge reads it, authenticates it, and routes it to your MT5 Expert Advisor. (For the full end-to-end picture, see How to Connect TradingView to MT5.)
Note: webhook alerts require a paid TradingView plan. The webhook notification option is not available on the free tier.
How to set up a TradingView webhook alert (step by step)
Step 1: Open the alert dialog
On your chart, click the alert (alarm clock) icon, or right-click the chart and choose Add alert.
Step 2: Set the condition
Choose what triggers the alert. Two common patterns:
- Indicator condition: e.g. "RSI crossing 30", selected from the condition dropdowns.
- Strategy
alert()calls: if your Pine Script uses thealert()function, select "Any alert() function call". This lets the script itself decide the message dynamically (more on this below).
Step 3: Enable the webhook
Open the Notifications tab in the alert dialog, tick Webhook URL, and paste the endpoint from your bridge. This is the address every trigger of this alert will POST to.
Step 4: Write the alert message
In the Message box, enter the payload in the exact syntax your bridge expects. This is the single most important field. See the syntax section next.
Step 5: Set expiration and trigger frequency
Choose Once Per Bar Close for most strategies (avoids repainting/intrabar false fires), and set the expiration as far out as your plan allows so the alert doesn't silently die.
Step 6: Create and test
Save the alert, then trigger a test (a manual alert or a demo condition) and confirm the order lands correctly in a demo MT5 account before going live.
TradingView alert syntax: the part everyone gets wrong
The alert message is not free-form English. It's a structured instruction that the bridge parses field by field. There are two common formats.
Plain comma-separated syntax
Many MetaTrader bridges use a simple, readable line:
<routing_id>,buy,EURUSD,risk=1,sl=30,tp=60
Read as: this account → open a buy on EURUSD → risk 1% → 30-pip stop loss → 60-pip take profit. Change buy to sell, closelong, or closeshort for other actions. The exact keywords depend on the bridge's documentation, but the shape is always: identifier, action, symbol, then parameters. NexumTrader uses this form rather than JSON, and its webhook payload reference has the complete grammar.
JSON syntax
Other bridges (and most multi-platform routers) expect JSON:
1{2 "id": "YOUR_ROUTING_ID",3 "action": "buy",4 "symbol": "EURUSD",5 "risk": 1,6 "sl": 30,7 "tp": 608}
JSON is more verbose but less ambiguous and easier to extend with extra fields.
Using TradingView placeholders
TradingView can inject live values into the message at trigger time using curly-brace placeholders:
1{2 "action": "buy",3 "symbol": "{{ticker}}",4 "price": "{{close}}",5 "time": "{{timenow}}"6}
Common placeholders include {{ticker}}, {{close}}, {{strategy.order.action}}, {{strategy.position_size}}, and {{timenow}}. These let one alert adapt to whatever the chart is doing instead of hard-coding a symbol.
Driving messages from Pine Script with alert()
For dynamic strategies, don't hard-code the message in the alert box; generate it inside Pine Script with the alert() function:
1//@version=62strategy("Webhook demo", overlay = true)34routingId = input.string("PLACEHOLDER_ID", "Routing ID")5brokerSymbol = input.string("PLACEHOLDER_SYMBOL", "Broker symbol")67longCondition = ta.crossover(ta.sma(close, 10), ta.sma(close, 30))8if longCondition9 strategy.entry("Long", strategy.long)10 alert(routingId + ",buy," + brokerSymbol + ",risk=1", alert.freq_once_per_bar_close)11
Then in the TradingView alert dialog you simply select "Any alert() function call" and leave the message box empty; the script supplies the payload. This is the cleanest way to run a multi-signal strategy through a single alert. We go deeper on this in From Pine Script Indicator to Live Automated Strategy.
Security: never expose an unauthenticated webhook
A webhook URL is a public endpoint. If someone learns it and knows your syntax, they could send orders. Two protections matter:
- Signal authentication: an identifier embedded in every message so the bridge rejects anything that doesn't carry it. The routing ID in the examples above serves exactly this purpose, which is also why a script carrying your real one should not be published.
- A bridge that validates every payload: dropping malformed or unauthorized messages rather than blindly executing them.
NexumTrader verifies every routed signal before it reaches MT5, and records the ones it rejects rather than discarding them silently.
Troubleshooting: alert fired but nothing happened
- Message syntax doesn't match the bridge: the most common cause. One wrong keyword or a missing comma and the payload can't be parsed.
- Wrong symbol name: the broker uses
XAUUSD.rbut your message saysXAUUSD. The symbol in the payload has to match what the terminal calls the instrument. - Webhook not ticked: the alert fired a popup/email but no HTTP POST because the Webhook URL box wasn't enabled.
- Free TradingView plan: webhooks require a paid tier.
- EA/terminal offline: the bridge received the signal but had nowhere to deliver it.
FAQ
Do TradingView webhook alerts require a paid plan?
Yes. The webhook notification option is only available on paid TradingView subscriptions.
Do I need to keep my computer on for webhooks to fire?
No, TradingView sends webhooks from its servers. But you do need your MT5 terminal online (ideally on a VPS) to receive and execute the resulting order.
What's the difference between alertcondition() and alert() in Pine Script?alertcondition() creates a reusable alert you configure manually in the dialog; alert() fires programmatically at runtime and can build a dynamic message, better for webhook automation.
Can one webhook alert control multiple symbols?
Yes, if you use the {{ticker}} placeholder or generate the symbol dynamically via alert() in Pine Script.
Why did my alert fire twice?
Usually an intrabar trigger. Set the alert to Once Per Bar Close and use alert.freq_once_per_bar_close in Pine Script to avoid duplicate fires.
This article describes how TradingView webhook alerts and order routing work with MetaTrader 5. It is not financial, investment or trading advice, and nothing in it is a recommendation to trade, to use any strategy, to size a position in any particular way, or to choose any provider. NexumTrader is order-routing software: it does not provide trading signals, portfolio management or investment recommendations. Trading carries risk of loss.
Route your alerts to every MT5 account.
Per-account risk, trading windows and session rules, from a single TradingView alert.
Keep reading

One Alert, Six Accounts: The Full Signal Path
A segment by segment trace of what happens between a TradingView alert firing and an order opening on each connected MT5 account, and where the time goes.

Six Prop Firm Rules That Differ From Account to Account
The same order can be inside the rules on one prop account and outside them on another. Six variables that differ per account, and why they interact.

One Strategy, Multiple Prop Firm Accounts: The Four Rules to Check First
Routing one TradingView strategy to several MT5 accounts? The rule that binds is rarely the copy trading clause.