General TradingView information. This section describes standard TradingView behavior, not a QuantNomad-specific feature. TradingView updates its interface regularly, so menu names and positions may differ slightly from what you see. When in doubt, check the TradingView Help Center.
How it works
When the alert fires, TradingView sends an HTTP POST request to the URL. The request body is the alert message, after placeholders such as{{ticker}} have been replaced.
Requirements
- A TradingView plan that includes webhook alerts. See TradingView pricing.
- Two-factor authentication on your TradingView account, if TradingView prompts for it when you enable webhooks.
- A receiving URL reachable from the internet. TradingView only accepts ports 80 and 443 in webhook URLs.
- A receiver that responds quickly. TradingView cancels the request if the server takes longer than about three seconds, so acknowledge first and do slow work afterwards.
Set up a webhook alert
1
Get the URL
Copy the webhook URL from the receiving service, or set up an endpoint on your own server.
2
Write the message
Use the format the receiving service expects. If the message is valid JSON, TradingView sends it with a JSON content type. Otherwise it’s sent as plain text.
3
Attach the webhook
In the alert’s Notifications tab, enable Webhook URL and paste the URL.
4
Test
Trigger a test alert and confirm the receiving service got the expected message.
JSON message template
Your message must be editable for this to work. Scripts that usealert() calls send their own fixed message. For strategies such as UT Bot v2 and UT Bot Pro, use Order fills only alerts, which let you write the message and use strategy placeholders:
{{strategy.order.action}}isbuyorsell, so one alert covers both directions.- Keep placeholder values in quotes so the message is always valid JSON.
- Include
fired_atso the receiver can reject delayed or duplicate messages.
A minimal receiver
A small example of a server that receives and logs webhook alerts. It’s a starting point for testing, not a production trading system.webhook_receiver.py
Security
- Include a long, random secret in the URL path or in the message, and reject requests without it.
- Never put exchange API keys or passwords in the alert message.
- Validate every field before acting on it, and reject unexpected symbols or values.
- Make the receiver idempotent: the same alert received twice should not place two orders.
Before automating real trades
- Paper trade the full chain (indicator → alert → webhook → execution) first.
- Use Once Per Bar Close triggers to avoid acting on signals that later disappear. See Confirmed vs Unconfirmed Signals.
- Monitor the alert log and your receiver’s logs. Webhooks can be delayed or fail.
- Add limits in the execution layer: maximum position size, maximum orders per day, and a way to stop everything quickly.