Black FridayCyber MondayLast day: 40% off every plan · monthly and yearlySee plans
Trading Strategies

TradingView Webhook Alerts: How to Automate a Strategy

A TradingView webhook turns each strategy alert into a message a bot can trade on. Here is the setup step by step, and the weak links to fix before real money runs through it.

Navixa12 min read

Illustration: a notification bell sends a glowing envelope along a cable to a robot hand that presses a green button on a trading terminal showing candlesticks

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.

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:

Flow diagram of a TradingView webhook setup in four steps: the strategy fills an order on TradingView's servers, the alert fires, TradingView sends an HTTP POST to the URL, and the receiver places the order. Beside each step, what can go wrong: changed settings are ignored, an alert that fires more than 15 times in 3 minutes is stopped, a receiver slower than 3 seconds is cut off, and late or repeated messages must be refused.
The chain behind every automated TradingView trade, with the limits from TradingView's help pages (read on 30 Nov 2026).
  1. 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.
  2. 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.
  3. TradingView sends the webhook. If the message is valid JSON, it goes out with an application/json header, 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.
  4. 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 needWhyWhere it comes from
A paid TradingView planWebhooks are not on the free planTradingView, billed by TradingView
Two-factor authenticationTradingView only allows webhook alerts with 2FA onAccount settings, Privacy and Security
A strategy that fits your marketStrategy alerts carry the order detailsYour own Pine Script, or a published or invite-only strategy
A receiverSomething has to turn the message into an orderAn exchange signal bot, a third-party service or your own server
An exchange accountThe orders are placed thereYour 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

ReceiverHow it connectsGood forWatch out for
Your exchange's own signal botThe exchange gives you a webhook URL and a message template; no API key leaves the exchangeSimple setups on one exchangeFixed message format, and only the markets the exchange supports
A third-party execution serviceYou give it an exchange API key, it gives you a webhook URLSeveral exchanges, more order optionsYou trust a third party with a key to your account
Your own serverYou write the code that reads the message and calls the exchange APIFull controlYou 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_LONG and EXIT_LONG, with a signalToken that identifies your signal. A maxLag field, 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:

PlaceholderWhat 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:

ActionPosition after the fillWhat happened
buylongA long was opened or added to
selllongPart of a long was closed
sellflatA long was closed
sellshortA short was opened, or a long was reversed into a short
buyflatA 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

  1. Open the chart with the right symbol and timeframe, and add the strategy with the settings you tested.
  2. Create an alert and choose the strategy as its condition, firing on order fills.
  3. Paste your message into the alert's message field. If your receiver gave you a template, use it exactly as given.
  4. In the notification settings, switch on Webhook URL and paste the receiver's address.
  5. 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:

Chart of how the 58 positions of Navixa Price Action on BTCUSDT.P 4h ended from October 2019 to October 2026: 26% reached the first and second target, 38% reached the first target and closed the rest at breakeven, 27% were stopped before the first target and 9% were closed by a reversal, with the order fills a bot follows on each path
How Price Action's Bitcoin positions ended, and what a bot has to follow on each path. Past backtest results, fees and slippage included.

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 linkWhat happensHow to guard against it
Receiver slower than 3 secondsTradingView cancels the requestReply first, then place the order
Webhook not deliveredNo order, and TradingView's help page describes no retryCheck the alert log, and compare positions daily
Exit alert lostThe strategy is flat, your exchange position is still openKeep a protective stop on the exchange
Settings changed after the alertThe alert keeps trading the old settingsDelete and recreate the alert after every change
Message arrives lateThe order fills far from the strategy's priceRefuse messages older than a set limit, as OKX does with maxLag
Same message twiceThe bot doubles a positionIgnore repeated order IDs and timestamps
Too many fills in a burstThe alert is stopped after 15 triggers in 3 minutesAvoid very low timeframes for order-heavy strategies
⚠️Warning

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.com that 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.

Quick Quiz
You change the risk setting of a strategy that already has a webhook alert on it. What does the alert do?

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.

Was this article helpful?

Ready when you are

Get your seat on TradingView

Pick a plan and your invite-only strategy is activated within 24 hours.

  • Full reports published
  • Every coin we tested, losers included
  • Cancel anytime