To automate a TradingView strategy, you create an alert on it, switch on Webhook URL and paste the address of a receiver: a signal bot on your exchange, a third-party execution service or your own server. Each time the strategy fills an order, TradingView sends your alert message to that address, and the receiver places the order on the exchange. You need a paid TradingView plan, two-factor authentication, a strategy that sends alerts and a receiver. The setup takes minutes. The real work is making sure a lost or late message can't leave you with a position you don't know about.
Key takeaways
- A webhook is only a message: TradingView posts your alert text to a URL, and something else has to place the order.
- You need a paid TradingView plan and two-factor authentication. The receiver must answer within 3 seconds, on port 80 or 443.
- Strategy alerts fire only on live order fills, and each alert runs a frozen copy of the strategy: after any change, delete it and create it again.
- One position can send several alerts. On Navixa Price Action's Bitcoin backtest, 64% of positions closed in two parts.
- Give a bot a trade-only API key with no withdrawals and an IP allowlist, and keep a stop on the exchange in case an exit alert is lost.
What a TradingView webhook does, and what it doesn't
A webhook is an HTTP POST request. When an alert fires, TradingView sends the alert's message to the URL you entered, and that's all it does. It doesn't log in to your exchange, it doesn't check that the order went through, and its help page says webhooks "may occasionally fail to reach the specified URL".
With a strategy, the chain has four links:

- The strategy fills an order. When you create an alert, TradingView makes a copy of the strategy on its servers and runs it there, so your browser can be closed. The alert fires when that copy's simulated broker fills an order.
- The alert fires, but only for live fills. TradingView doesn't send alerts for orders on historical bars, and it stops an alert that triggers more than 15 times in 3 minutes.
- TradingView sends the webhook. If the message is valid JSON, it goes out with an
application/jsonheader, otherwise as plain text. Only ports 80 and 443 are accepted, IPv6 isn't supported, and a request is cancelled if the receiver takes more than three seconds to process it. - The receiver places the order. It reads the message, checks it and sends the order to the exchange through the exchange's API.
What you need before you start
| You need | Why | Where it comes from |
|---|---|---|
| A paid TradingView plan | Webhooks are not on the free plan | TradingView, billed by TradingView |
| Two-factor authentication | TradingView only allows webhook alerts with 2FA on | Account settings, Privacy and Security |
| A strategy that fits your market | Strategy alerts carry the order details | Your own Pine Script, or a published or invite-only strategy |
| A receiver | Something has to turn the message into an order | An exchange signal bot, a third-party service or your own server |
| An exchange account | The orders are placed there | Your exchange, with an API key if the receiver needs one |
The alert limits and how long an alert stays active differ by plan, so check TradingView's pricing page for your plan before you build around it.
Step 1: Choose the receiver
| Receiver | How it connects | Good for | Watch out for |
|---|---|---|---|
| Your exchange's own signal bot | The exchange gives you a webhook URL and a message template; no API key leaves the exchange | Simple setups on one exchange | Fixed message format, and only the markets the exchange supports |
| A third-party execution service | You give it an exchange API key, it gives you a webhook URL | Several exchanges, more order options | You trust a third party with a key to your account |
| Your own server | You write the code that reads the message and calls the exchange API | Full control | You run it, secure it and keep it online yourself |
Two exchange examples, from their own documentation:
- Binance offers Webhook Signal Trading for USDⓈ-M futures. Binance creates the webhook URL and the alert message for you, the symbol in the alert must match the one the signal was made for, a user can have up to 100 active signals, and a signal is stopped after 20 failed attempts (Binance FAQ, updated 24 September 2026).
- OKX Signal Bots read actions such as
ENTER_LONGandEXIT_LONG, with asignalTokenthat identifies your signal. AmaxLagfield, 60 seconds by default, makes the bot ignore a signal that arrives later than that after the{{timenow}}timestamp in the message (OKX alert message spec).
That last idea is worth copying whatever receiver you use: a signal that arrives late should be refused, not traded at a worse price.
Step 2: Check the strategy before you automate it
Automation doesn't improve a strategy; it only executes it faster and without second thoughts. Before an alert touches money, run the strategy in TradingView's Strategy Tester on the exact symbol and timeframe the alert will use, with realistic commission and slippage. Our guide on how to backtest a crypto strategy on TradingView walks through the settings and the five numbers to read first.
Two checks matter most for automation:
- Does it repaint? A strategy whose past signals change after the fact backtests better than it trades. Alerts only fire on live fills, so a repainting strategy's live trades won't match its report.
- Does the symbol match? A strategy tested on
BTCUSDT.P(a perpetual) and an alert sent to a spot bot will not behave the same, and many receivers reject a symbol they weren't set up for.
Step 3: Write the alert message
The message is the text TradingView sends. Most receivers expect JSON with fixed field names, so start from the template your receiver gives you. Inside it, TradingView fills in placeholders, written in double curly braces, at the moment the alert fires. The most useful ones for a strategy, from TradingView's strategy alert and placeholder pages:
| Placeholder | What it returns |
|---|---|
| {{strategy.order.action}} | "buy" or "sell" for the filled order |
| {{strategy.order.contracts}} | The size of the filled order |
| {{strategy.order.price}} | The price at which the order was filled |
| {{strategy.order.id}} | The order's ID from the script |
| {{strategy.market_position}} | The position after the fill: "long", "flat" or "short" |
| {{strategy.order.alert_message}} | A custom message the script set for this order |
| {{ticker}} | The symbol, for example BTCUSDT.P |
| {{timenow}} | The time the alert fired, in UTC |
A generic message for your own receiver could look like this:
{
"token": "the-token-your-receiver-gave-you",
"action": "{{strategy.order.action}}",
"position": "{{strategy.market_position}}",
"symbol": "{{ticker}}",
"qty": "{{strategy.order.contracts}}",
"price": "{{strategy.order.price}}",
"order_id": "{{strategy.order.id}}",
"sent_at": "{{timenow}}"
}The token identifies the alert to your receiver. It is not a password: TradingView warns against putting login credentials or passwords in the webhook URL or message, and an exchange API secret never belongs there either.
Telling entries from exits
{{strategy.order.action}} alone is ambiguous: a "sell" can open a short or close a long. Read it together with {{strategy.market_position}}, the position after the fill:
| Action | Position after the fill | What happened |
|---|---|---|
| buy | long | A long was opened or added to |
| sell | long | Part of a long was closed |
| sell | flat | A long was closed |
| sell | short | A short was opened, or a long was reversed into a short |
| buy | flat | A short was closed |
If you write the strategy yourself, there is a cleaner way: give every order its own text with the alert_message argument of strategy.entry, strategy.exit or strategy.order, and put {{strategy.order.alert_message}} in the alert's message. Then each fill sends exactly the instruction your receiver expects (Pine Script alerts FAQ).
Step 4: Create the alert and add the webhook URL
- Open the chart with the right symbol and timeframe, and add the strategy with the settings you tested.
- Create an alert and choose the strategy as its condition, firing on order fills.
- Paste your message into the alert's message field. If your receiver gave you a template, use it exactly as given.
- In the notification settings, switch on Webhook URL and paste the receiver's address.
- Give the alert a clear name (symbol, timeframe, strategy) and create it.
From now on, treat the alert as fixed. TradingView runs the copy it saved when you created the alert, so later changes to the chart's strategy have no effect on it. To change a setting, delete the alert and create a new one.
Step 5: Test it small, then read the alert log
- Start with the smallest size the exchange allows, or with a receiver in test mode if it has one, and let a few real alerts go through.
- Check every alert in TradingView's alert log. Its Webhook status column shows whether each webhook was delivered.
- Compare both sides. After each fill, the position on the exchange should match the strategy's position in the Strategy Tester. If they drift apart, stop the bot and find out why before the next signal.
One position, several alerts
Many strategies don't close a position in one order. They take part of it off at a first target, move the stop and let the rest run, and each of those exits is a separate order fill with its own alert. Navixa's Price Action strategy works this way, and its published Bitcoin backtest shows how often a bot has to handle more than one exit per trade:

64% of the positions reached the first target, so they closed in two parts. In TradingView's report, the 58 positions show up as 115 rows, because each exit of each part is listed on its own. For a bot, that means three rules:
- Close the share each exit message names, not the whole position. A bot that closes everything at the first target turns a two-part exit into a one-part exit, and the results stop matching the backtest. Our post on taking profit in parts shows why that changes the outcome.
- Move the stop yourself if the bot keeps one on the exchange. Moving a stop is not an order fill, so it sends no alert.
- Handle the order of messages on a reversal. When the strategy flips from long to short, the exit has to be processed before the new entry, or the bot may net the two against each other.
Where automated setups break
| Weak link | What happens | How to guard against it |
|---|---|---|
| Receiver slower than 3 seconds | TradingView cancels the request | Reply first, then place the order |
| Webhook not delivered | No order, and TradingView's help page describes no retry | Check the alert log, and compare positions daily |
| Exit alert lost | The strategy is flat, your exchange position is still open | Keep a protective stop on the exchange |
| Settings changed after the alert | The alert keeps trading the old settings | Delete and recreate the alert after every change |
| Message arrives late | The order fills far from the strategy's price | Refuse messages older than a set limit, as OKX does with maxLag |
| Same message twice | The bot doubles a position | Ignore repeated order IDs and timestamps |
| Too many fills in a burst | The alert is stopped after 15 triggers in 3 minutes | Avoid very low timeframes for order-heavy strategies |
The strategy's stop lives on TradingView, not on your exchange. If the exit alert is lost or rejected, nothing closes the real position. Whatever receiver you use, keep a protective stop order on the exchange for every open position.
Keep the keys and the account safe
A webhook setup is only as safe as the exchange key behind it:
- Use an exchange's own signal bot where it fits. Then no API key has to leave the exchange. Binance's own advice is to never share API keys with third parties.
- If a service needs a key, give it one key, for one purpose. Allow trading only and never withdrawals, and restrict it to the service's IP addresses if it publishes them. Binance recommends an IP allowlist on every key, and it deletes a key with no allowlist after 30 days without use.
- Lock down your own server. TradingView publishes the four IP addresses its webhooks come from, so your server can refuse everything else, and with HTTPS it sends a certificate for
webhook-server@tradingview.comthat proves a request came from TradingView (webhook authentication). - Protect the TradingView account. Whoever can log in can edit your alerts. Two-factor authentication is required for webhooks anyway; keep the backup codes somewhere safe.
How Navixa's strategies fit a webhook setup
Navixa's two strategies run inside your own TradingView account. Navixa doesn't send webhooks and never connects to your exchange: TradingView sends the alerts to whatever receiver you choose.
- Price Action sends an alert for every entry and every exit. The messages carry the side, quantity, stop, both targets, the exit reason and the share to close, as JSON or text, and on a reversal the exit goes out before the new entry. That is what a bot needs to follow the two-part exits shown above and to place its own stop on the exchange.
- Smart DCA sends an alert for every buy of its ladder and for the sale. It needs a signal (webhook) bot that executes each alert as it arrives. Exchange DCA bots that run their own fixed ladder can't follow it.
You can also skip automation and place the orders by hand from the alerts: the messages are the same either way.
FAQ
Do I need a paid TradingView plan for webhooks?
Yes. Webhook alerts are not part of the free plan, and they also require two-factor authentication on your account. Alert limits and alert duration differ by plan, so check TradingView's pricing page for the current details.
Can TradingView place trades on my exchange by itself?
Not through a webhook. A webhook only delivers a message to a URL. An exchange signal bot, a third-party service or your own server has to read that message and place the order.
Does TradingView retry a failed webhook?
TradingView's help page describes no retry. It says webhooks may occasionally fail and points to the Webhook status column in the alert log to check delivery. Plan for missed messages: keep a stop on the exchange and compare positions regularly.
Can I automate an indicator instead of a strategy?
Yes, indicator alerts can send webhooks too. But an indicator only says that a condition happened; it doesn't track a position. With a strategy, every alert is an order fill with its size and price, so the receiver can mirror the strategy's position exactly.
The bottom line
A TradingView webhook is a simple pipe: the strategy fills an order, TradingView posts a message, a receiver turns it into an exchange order. The pipe itself takes minutes to set up. Making it safe takes more care: test the strategy first, refuse late and repeated messages, follow partial exits share by share, keep a stop on the exchange and use keys that can't withdraw. If you want a strategy whose alerts already carry the stop, both targets and the share to close, see how Navixa Price Action plans each trade before entry.



