NEXUM TRADER
← Back to the journal
BlogJul 19, 2026 · 5 min read

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.


TradingView Webhook Alerts: Setup, Syntax & Automated Execution

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 the alert() 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:

1<license_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.

JSON syntax

Other bridges (and most multi-platform routers) expect JSON:

1{
2 "id": "YOUR_LICENSE_ID",
3 "action": "buy",
4 "symbol": "EURUSD",
5 "risk": 1,
6 "sl": 30,
7 "tp": 60
8}


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:

1pine
2//@version=5
3strategy("Webhook Demo", overlay=true)
4
5longCondition = ta.crossover(ta.sma(close, 10), ta.sma(close, 30))
6if longCondition
7 strategy.entry("Long", strategy.long)
8 alert('{"action":"buy","symbol":"' + syminfo.ticker + '","risk":1}', alert.freq_once_per_bar_close)

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: a secret key/ID embedded in every message so the bridge rejects anything that doesn't carry it. Your license ID in the examples above serves exactly this purpose.
  • A bridge that validates every payload: dropping malformed or unauthorized messages rather than blindly executing them.

NexumTrader treats authentication as non-negotiable: every routed signal is verified against your key before it ever reaches MT5. (Join the launch waitlist at nexumtrader.com.)

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.r but your message says XAUUSD. Use symbol mapping.
  • 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.