A webhook retry is a second chance for a signal to arrive, and it is also a second chance for your bot to place the same order twice. TradingView resends a webhook after 5 seconds when your server returns an HTTP 500 to 599 error, except 504, and allows up to 3 resends, so 4 sends in total. A safe trading bot acknowledges fast, stores the signal before acting, and treats every repeat of the same signal as harmless.
This guide covers what TradingView does when delivery fails, why bots miss or double signals, and the handler design that fixes both. It is written for traders who run their own endpoint, and it closes with how the same risks are handled when a hosted bridge such as Tickerly receives the alert instead.
TL;DR
- TradingView retries only on certain 5xx responses, up to 3 times, and cancels any request your server takes longer than 3 seconds to process.
- Return a 2xx immediately after saving the signal, then place the order in the background. Never trade inside the request.
- Assume duplicates will happen. On your own endpoint, give every signal a deterministic ID and refuse to process an ID twice.
- On Tickerly, which does not deduplicate alerts, stop repeats at the source: one alert per strategy and connection, and exits sent with
prev_position, so a repeated exit can only flatten a position. - Treat the broker or exchange as the source of truth for positions, and reconcile against it on a schedule.
- Check the alert log’s webhook status column first when a signal seems lost.
Table of Contents
- What TradingView does when a webhook fails
- Why signals get missed, delayed, or doubled
- The handler pattern: acknowledge, persist, then act
- Make every signal safe to repeat
- Handling stale and out-of-order signals
- Reconcile against the exchange
- A debugging routine when a signal “didn’t fire”
- Our perspective: why we don’t ask you to run this yourself
- Skip the infrastructure with Tickerly
- A short checklist before you go live
- FAQ
- Sources
What TradingView does when a webhook fails
The behavior is narrower than most traders assume. Three official rules define it.
Retries are limited and conditional. According to TradingView’s webhook resubmission page, a resend happens after 5 seconds when the receiver answers with a 500 to 599 status, with 504 excluded. You get at most 3 resends. A 4xx response, a refused connection, or a bad URL is not covered by that rule, so do not count on a retry to rescue those.
The clock is short. TradingView cancels a webhook request if the remote server takes longer than three seconds to process it. A bot that calls an exchange API, waits for the fill, and only then responds is gambling with that window.
The destination is constrained. The same page states that only ports 80 and 443 are accepted. A bot listening on port 8080 behind no proxy will never receive anything.
TradingView also says webhook alerts may occasionally fail to reach the URL, and you can monitor delivery in the alert log’s Webhook status column. That column is your first diagnostic tool, before you open any server logs.

Why signals get missed, delayed, or doubled
TradingView lists network issues, an overloaded server, and an invalid or unavailable URL as common causes of webhook errors. In trading bots, those causes show up in a few recognizable patterns.
Missed signals
- Your server was down or restarting during a deploy, and the failure was a connection error rather than a retryable 5xx.
- A firewall, proxy, or certificate problem blocked the request before your code saw it.
- The URL changed, or the endpoint returned 404 after a rewrite.
- A burst of alerts at a bar close overloaded a single-threaded process.
Delayed signals
- The handler waited on an exchange response before replying, so the request ran into the 3-second limit.
- A retry arrived 5 seconds or more after the original, when the price had already moved.
Doubled signals
This is the dangerous one. Your bot receives the alert, places the order, then errors out or times out before it responds. From TradingView’s side the delivery failed, so a retry may follow. Your bot sees a fresh request and buys again. The order went through, the acknowledgment did not, and the retry mechanism did exactly what it was built to do.

AWS makes the general point about messaging systems: processing is at least once, so duplicates can occur, and idempotent code is strongly recommended. Retries are not a bug to eliminate. They are a property to design around.
The handler pattern: acknowledge, persist, then act
The core fix is to split receiving from trading. Your public endpoint should do only a few cheap things and answer quickly.
- Authenticate the request. TradingView webhooks cannot add custom headers, so put a long random secret in the URL path or the alert message body and check it. Reject everything else.
- Validate the payload. Confirm the fields you need (symbol, side, size or percentage, a signal ID) exist and make sense.
- Persist it. Write the signal to a database table or a queue.
- Return 200. Do this before any exchange call.
- Process in the background. A worker picks up the saved signal and places the order.
This matches guidance from several infrastructure providers. GitHub recommends that receivers return a 2XX within 10 seconds and queue payloads to process asynchronously, so slow business logic never blocks the response. Fireblocks gives the same advice because synchronous processing can cause timeouts and overload when volume surges. TradingView’s limit is 3 seconds rather than 10, so for a trading bot the discipline matters even more.
Order matters at step 3 and 4. AWS’s architecture guidance says an asynchronous acknowledgement should be sent only after the message is durably persisted. In other words, a 200 means “I have safely received this,” not “the trade is done.” If you reply 200 and then lose the signal in memory, no retry will ever come.
What to return when saving fails
If the write to your queue or database fails, return a 500. Railway’s webhook guidance says to return 500 if enqueueing fails so the sender can retry. With TradingView, that 500 triggers the resend described above, which is exactly what you want when you could not store the signal. Just avoid 504 in that path, because TradingView does not retry it.
Make every signal safe to repeat
Because a retry can follow a trade that already happened, the handler must be idempotent: processing the same signal twice must have the same effect as processing it once.
Give each signal a deterministic ID
The ID should come from the signal itself, not from the time it arrived. A practical recipe is to combine the strategy name, symbol, bar time, and side. TradingView lets you place placeholders such as the ticker and the bar time in the alert message, so the same logical signal always produces the same ID, no matter how many times it is delivered. A random ID generated on your server would defeat the purpose, because each retry would look new.
Use the database to enforce it
Stripe’s documentation shows the standard approach: attempt an atomic insert with the event ID as a unique key, skip processing if the constraint reports a duplicate, and return success. Do not check “have I seen this?” in one query and insert in another. Two simultaneous retries can both pass the check. Let the unique constraint decide.
A minimal flow looks like this:
| Step | What happens | Response |
|---|---|---|
| Insert signal ID succeeds | New signal, queue it for the worker | 200 |
| Insert fails on unique key | Duplicate delivery, skip it | 200 |
| Insert fails for another reason | Signal not stored | 500, so a retry follows |
Notice that the duplicate case still returns 200. You are telling TradingView that the signal is safely held, which stops further resends.
Idempotency applies downstream too
Your worker can also crash after the exchange accepted the order but before it marked the signal done. Use a client order ID on the exchange request where the exchange supports one, derived from the same signal ID. Then a repeated submission is rejected by the exchange instead of filling twice. Check your exchange’s API documentation for the exact field name and rules.
Handling stale and out-of-order signals
A retry that arrives 5, 10, or 15 seconds late can be worse than a missed signal if your strategy trades on bar closes. Two checks help.
Add a staleness rule. Include the bar time in the payload and compare it with the current time in the worker. If the signal is older than your tolerance (a few seconds on a 1-minute chart, longer on a 4-hour chart), log it and skip it. You decide the threshold per strategy.
Do not assume order. Fireblocks warns that delivery order is not guaranteed and recommends tracking event IDs and comparing timestamps. An exit signal that arrives before its entry signal should not open a short by accident. Handlers that act on the intended end state, such as “be flat” or “be long 1 unit,” are more forgiving than handlers that blindly add and subtract.
Reconcile against the exchange
Even with all of this in place, a signal can fall through. The fix is a periodic reconciliation job. Treat the broker or exchange as the source of truth for what you hold, and compare it to what your bot believes. When they disagree, alert yourself, and decide in advance whether the bot corrects the drift automatically or waits for you.
This is also where a dead-letter queue earns its place. Amazon SNS, for example, retries failed deliveries with backoff and uses a dead-letter queue to hold messages that could not be delivered, for analysis or reprocessing. Apply the same idea to your worker: after a fixed number of failed attempts with increasing delays, park the signal somewhere visible rather than retrying forever. A stale order retried for an hour is a liability.
Retry rules for your worker
- Retry only errors that are temporary: timeouts, 429 rate limits, 5xx from the exchange.
- Never retry rejections that will not change, such as insufficient balance or an invalid symbol.
- Use exponential backoff with a small cap and a maximum number of attempts.
- Before each retry, check the signal’s age against your staleness rule and check whether the order already exists.
A debugging routine when a signal “didn’t fire”
Work from the outside in.
- Open TradingView’s alert log and read the Webhook status for that alert. This tells you whether TradingView considers delivery successful.
- Confirm the URL and port. Only 80 and 443 work.
- Check your edge logs. Did the request reach your server, and what status did you return?
- Check your signal table. Was the ID stored? Was it flagged as a duplicate?
- Check the worker and exchange logs. Was the order rejected, and why?
If you use a hosted bridge, the same logic applies at a different layer. Tickerly keeps a trading bot alert log so you can see what arrived and what happened to it, and you can confirm your setup before real money is involved with a manual test alert from Tickerly or a demo connection (any connection with “test” in its name routes to the exchange’s demo account, where the exchange has one).
Our perspective: why we don’t ask you to run this yourself
We built Tickerly because most traders who write a good Pine Script strategy do not want to also operate a production webhook service. Everything above is reasonable engineering, but it is a lot to get right: a public HTTPS endpoint, a queue, a database, a worker, monitoring, and a VPS to host it. Every piece is another place for a signal to die at 3 a.m.
Our view is that execution is where automation succeeds or fails. A strategy that backtests well but receives a signal late, twice, or not at all is a different strategy from the one you tested. That is why we focus on a short alert-to-order path (each order placed within a fraction of a second of the alert), a setup that needs no code and, for direct exchange connections, no VPS, and visibility into every alert through the log.
If you do run your own endpoint, our advice is simple. Acknowledge fast, store first, trade second, make every signal safe to repeat, and check your positions against the exchange. If you would rather spend your time on the strategy, a managed route is a legitimate choice. You can see how we think about the full path in our guide to TradingView strategy automation and our notes on low latency TradingView bots.
— Jay
Skip the infrastructure with Tickerly
Tickerly turns your TradingView alerts into live orders on supported crypto exchanges, forex, stocks, futures, and MetaTrader 4 and 5, with no coding, and no VPS for direct exchange and broker connections (on MetaTrader, the Tickerly TV Connector runs inside your own terminal, which has to stay running). Every plan starts with a 30-day free trial. Paid plans are published at $19 per month for Level 2, $29 per month for Level 3, $39 per month for Level 4, which adds MetaTrader 4 and 5, and Level 4 Ultra for traders who need 2,500 alerts a day, with differences in supported asset classes, strategies, and alert limits. Compare them on the Tickerly plans page.
If you are connecting a specific venue first, the setup guides for TradingView to Binance and TradingView to Bybit walk through validation before you go live. Our page on TradingView alerts for trading bots covers the alert side in detail.
Two of the safeguards in this guide work differently on Tickerly. It does not deduplicate alerts, and it does not compare your strategy’s position with the exchange’s, so duplicates are stopped at the source instead:
- Create one alert per strategy and exchange connection, and use the strategy’s own order-fill alerts, so each order is sent once.
- Send exits with
prev_position. Tickerly marks closing orders reduce-only, so a repeated or oversized exit can only flatten a position, never open one in the opposite direction. - Read the alert log, which records each alert and the exchange’s response, and check the exchange after anything unusual. If the strategy and the account drift apart, a close all alert flattens the symbol in one step (not on Alpaca or MetaTrader), so both can start flat again.
A short checklist before you go live
If you run your own endpoint, check each of these before going live:
- Endpoint uses HTTPS on port 443 and rejects requests without your secret.
- Handler answers in well under 3 seconds, with no exchange calls in the request.
- Signals are written to durable storage before the 200 is sent.
- Signal IDs are deterministic and enforced by a unique constraint.
- Duplicates return 200, storage failures return 500.
- Worker retries only temporary errors, with backoff, a cap, and a dead-letter destination.
- Stale signals are skipped and logged.
- A scheduled job compares your bot’s positions with the exchange.
- You have tested by sending the same alert twice, and by killing the worker mid-trade, on a test account first.
On Tickerly there is no endpoint, queue or worker for you to run. The webhook URL is http://alerts.tickerly.net, plain HTTP by design, because the alert carries no credentials, just the ticker, the order and your private pointer. What stays on your list: one alert per strategy and connection, exits sent with prev_position, a first run on a demo connection, and a look at the alert log after the first trades.
FAQ
Does TradingView retry failed webhooks?
Sometimes. It resends after 5 seconds when your server returns a 500 to 599 status other than 504, up to 3 resends. It does not promise delivery in other failure cases, so build your bot to cope with a missing signal as well as a repeated one.
How do I stop a retry from placing a second order?
Give each signal a deterministic ID built from the strategy, symbol, bar time, and side, and store it with a unique database constraint. When the insert reports a duplicate, skip the trade and still return 200. Pair this with a client order ID on the exchange request where supported. On Tickerly, which has no ID field and does not deduplicate, stop repeats at the source instead: one alert per strategy and connection, and exits sent with prev_position, so a repeated exit can only flatten your position.
Why does my bot time out even though the order goes through?
TradingView cancels requests that take longer than three seconds. If your handler waits for the exchange before replying, the trade can succeed while the response arrives too late. Move the order work to a background worker and reply right after saving the signal.
How can I tell whether TradingView delivered my alert?
Open the alert log and read the Webhook status column for that alert. If it shows a failure, check your URL, port (80 or 443 only), and server availability. If it shows success but no trade happened, the problem is inside your bot or at the exchange.
Sources
- Webhook resubmission, TradingView
- How to configure webhook alerts, TradingView
- What do errors mean when sending webhooks, TradingView
- Best practices for using webhooks, GitHub Docs
- Asynchronous communication, AWS Prescriptive Guidance
- Receive Webhooks at Scale, Railway Docs
- Migrate from snapshot events to thin events, Stripe Docs
- Invoking Lambda functions with Amazon SNS, AWS Docs
- Amazon SNS dead-letter queues, AWS Docs
- Best practices for webhooks, Fireblocks Developer Docs
Recommended
- Trading bot alert log
- Avoid Transmit Flag Errors: Bracket Orders Automation for Developers
- Oanda Trading Bot with TradingView strategies
- TradingView Alerts for Trading Bots
This article was produced with Al assistance and reviewed for accuracy. It is provided for general information only and is not professional or financial advice.

