What Is a TradingView Webhook Explained Simply

What is a TradingView webhook — alert fires, HTTP POST goes to a receiving server, server places the trade

You built a strategy on TradingView. It fires alerts. You watch, you click, you switch to your broker’s terminal, you type the order in by hand. By the time you’re done, the price has moved. That is where most automation stories start, and where most of them stall, because the next word is “webhook” and it sounds like a developer’s problem.

It isn’t, but the confusion is real. On the MQL5 forum a trader asked whether he could “hit webhook url with mt4” to push signals into a bot. Two moderators spent a page working out which direction he even meant. The answer that ended it: “TradingView is offering a Webhook API. You can use it from MT4, just use WebRequest. But of course MT4 can’t be the receiver, at least not easily” (Alain Verleyen, MQL5 moderator, July 2021). That one sentence contains the whole concept, and I’ll unpack it for you.

In this article, I’ll show you what a webhook is in one sentence and what actually happens in the four stages between your alert and a placed order. You’ll see what the message contains and the three things you need before the option even appears. Then I’ll walk you through a real trader’s payload and the six ways a webhook fails. And I’ll show you how to set one up so the message never has to carry your lot size or your symbol at all.

A Webhook in One Sentence

A webhook is a message that TradingView sends to a web address the moment one of your alerts fires. That’s the whole thing. No polling, no refreshing, no checking. Your condition triggers, and TradingView sends a small HTTP POST request, a packet of text, to the URL you typed into the alert. Whatever server sits at that URL reads the message and does something with it.

Think of it as a doorbell, not a delivery. TradingView presses the button and says “the thing you asked about just happened.” What gets done about it is decided entirely on the other side of the door. Keep that picture, because it explains almost every failure you’ll ever see.

How It Works, Step by Step

Between a candle closing on your chart and an order sitting at your broker there are four stages. The first two belong to TradingView. The last two belong to you, or to whatever service you use.

1. Alert evaluation.
TradingView’s servers check your alert conditions against live data. A price cross, an indicator signal, a strategy entry. When a condition is met, the alert is flagged. Normally this takes tens of milliseconds.
2. Webhook dispatch.
TradingView builds an HTTP POST and sends it to your URL. The body is whatever you typed into the alert’s Message field. If that text is valid JSON, it is sent as JSON; if not, as plain text. This is usually the slowest stage, and it gets slower on big news.
3. Your server receives it.
Your copier, bot or automation platform gets the POST, reads it, checks it. It has three seconds to answer. If it takes longer, TradingView cancels the request, and by TradingView’s own documentation it does not say it will retry.
4. Action.
The receiving side does whatever it was built to do. Place a trade, send a notification, write a log line. TradingView’s part ended at stage 2. Everything from here is on your side of the door.

End to end, from candle close to webhook arrival, expect well under a second on a normal day. During a Non-Farm Payrolls release or an FOMC statement it can stretch to a second or two, because stage 2 is shared with every other alert on the platform firing at the same moment.

What the Webhook Message Contains

Exactly what you put in the Message field. Nothing more. TradingView does not add the symbol, the price, the timeframe or the direction on its own. If you want them in the message, you type them in, either as fixed text or with TradingView’s placeholder variables, which get swapped for live values when the alert fires.

The simplest message is plain text:

buy EURUSD

A structured message for a bot that reads JSON looks like this:

{“action”: “buy”, “symbol”: “EURUSD”, “price”: {{close}}, “time”: {{timenow}}}

The double-brace pieces, {{close}}, {{timenow}}, {{ticker}}, are placeholders. Here the road forks. If your receiver reads JSON, which most custom bots and many platforms do, the message has to be well formed. One missing comma or one unclosed brace, and the receiver gets a request it can’t parse. If your receiver is built to work without you editing messages at all, the text comes pre-built and you paste it in. Which fork you’re on decides how much of this article you’ll need again at 2 AM.

What You Need Before You Can Use Webhooks

Three things, and you need all three. Miss one and the option either isn’t there or silently doesn’t deliver.

A paid TradingView plan.
Webhooks are not on the free tier. If the Webhook URL field is missing from your alert dialog, this is why. Current tiers are at tradingview.com/pricing.
Two-factor authentication on your account.
TradingView’s documentation says webhook alerts are only allowed with 2FA enabled (How to configure webhook alerts). The field may appear without it, but delivery won’t work.
A receiving URL.
The webhook needs somewhere to go: the URL your copier gives you, your own server, or an automation platform. It has to be HTTPS on port 80 or 443, a public domain, IPv4. Localhost and IPv6 are rejected.
A receiver that is not your terminal.
This is the one nobody tells you. MT4, MT5 and NinjaTrader cannot accept an incoming HTTP request on their own. “From trading view to mt4 you will need a server,” as another MQL5 regular put it in the same thread. The terminal is the last stop, never the front door.

One Real Payload, Hop by Hop

Let me take a message a real trader posted and follow it through the four stages. He was building his own Python bridge to MT5 and described his payload like this: “Right now my bot receives a JSON message containing the information it needs to send to MT5. It looks something like this: “signal”: “LONG”, “symbol”: “GBPUSD”, “volume”: 0.1, “stop_loss”: 10, “take_profit”: 10″ (Dean-Trades, September 2022).

Stage 1, on TradingView.
His long condition on GBPUSD is met at the close of a bar. The alert flags. Nothing about GBPUSD, 0.1 lots or the stops exists yet in TradingView’s mind. Those words are just his Message field.
Stage 2, the POST goes out.
TradingView sends that JSON to his server’s URL. If he had typed “volume”: 0.1, with a trailing comma before the closing brace, the text would still be sent, but as plain text, not JSON, because it isn’t valid JSON any more.
Stage 3, his bot parses it.
The bot reads “LONG”, finds GBPUSD in the broker’s symbol list, converts 0.1 to a lot size the broker accepts, turns 10 into points, and builds an order request. Every one of those is a place his own code can be wrong. He answered TradingView inside three seconds, so the request wasn’t cancelled.
Stage 4, the order goes to the broker.
MT5 sends a buy for 0.1 lots of GBPUSD with SL and TP ten points away. And then his actual question appears: “I should be able to create another alert which closes a trade based on a condition but how do I set that up?” The webhook can say “close”. Knowing which position to close, and how, is entirely the receiver’s job.

Notice what the webhook did in that story. It carried five words to a server. Everything that made a trade out of those words, the symbol lookup, the lot conversion, the stops, the close logic, happened on his side. That is the doorbell again, and it’s why a broken automation is almost never “the webhook”.

Common Webhook Failures (and What Actually Causes Them)

Webhooks look simple until the day they stop. Here is where they actually break, in roughly the order I see them.

The URL is wrong.
A typo, a trailing space, a missing character. TradingView doesn’t validate the URL when you save the alert, so the error only shows up on the first alert that fires, in the Webhook status column of your alert log.
The server took too long.
Three seconds is the limit. A slow, cold-starting or distant server gets its request cancelled, and the documentation describes no retry. On a news bar, when your server is busiest, this is the failure you’ll meet first.
The alert never fired.
The webhook is fine. The condition wasn’t met at the close. This is common with “Once Per Bar Close” on higher timeframes: the condition was true mid-bar and false at the close, and you only ever see the mid-bar version on your chart.
The message is malformed.
The receiver expects JSON and gets a missing quote, an extra comma, or a placeholder that never resolved and arrived as literal {{ticker}}. Request received, parse failed, message dropped.
The plan was downgraded.
Drop below the tier that includes webhooks and your alerts keep firing, but delivery silently stops. Nothing in the chart tells you.
The terminal was offline.
Webhook sent, server received it, and the terminal that should execute wasn’t connected. Real-time copiers don’t queue. If the terminal is dark when the signal arrives, that trade is gone.

When a trade goes missing and you don’t know which of these it was, don’t guess. Walk the chain from the alert log down, one layer at a time. We wrote that procedure out in full: TradingView Alert Fired But No Trade Executed: 7 Reasons.

The Latency Question: How Fast Is “Fast Enough”?

Every webhook adds time to your execution. Whether that time matters depends on what you trade. Here is where it goes, stage by stage, on a normal day and on a news day.

Stage Normal conditions During major events
Alert detection, TradingView Tens of milliseconds Up to a second
Webhook dispatch, TradingView Tenths of a second Up to two seconds
Platform processing, your copier About 0.1 to 0.15 s on ours, by our own measurement Slightly more under a burst of alerts
Broker execution Tenths of a second Several seconds on thin liquidity

The dispatch stage, TradingView’s own part, is usually the biggest single slice, and it’s the one you can’t touch. On our production infrastructure the whole chain, alert to broker, lands at about 0.5 seconds. If your strategy targets moves of twenty ticks and holds for minutes, that half second is noise. If you scalp three ticks on the ES open, the chain matters more than the strategy, and you should read When ~0.5s Execution Actually Matters before you buy anything.

How This Connects to Trade Copying

A webhook by itself does nothing. It moves a message from point A to point B. Everything that matters happens at B, and B is what a trade copier is. If you don’t have one yet, the architecture is laid out in What Is a Trade Copier.

Most webhook copiers work the way Dean’s bot did: receive the JSON, parse the symbol, look it up in the broker’s list, translate the lot size, submit. Every step is a place to fail, and the symbol lookup fails more often than the rest put together, which is why symbol mapping has its own article.

Here is the choice I’d make, and it’s the one we built. Use the webhook as the trigger, not as the instruction. The Receiver, our component inside your terminal, already sits on the chart of the instrument you want to trade, with the lot size and the stops set on its side. When the webhook arrives it doesn’t parse a symbol or open a mapping table. It executes on the chart it’s sitting on. The message says “go”. The Receiver already knows where and how.

Setting this up with Nordman Connector

Two ways, and both end at the same Receiver. In the No-Code workflow you copy a ready-made webhook message from the client area and paste it into the TradingView alert. No JSON, no placeholders to debug, and it works for protected indicators you can’t edit. In the Low-Code workflow you edit the Pine Script alert conditions yourself for custom logic and use the same webhook URL. Either way the Receiver in MT4, MT5 or NinjaTrader 8 executes on its chart. Every alert is logged in the panel with an ID, and you get a Telegram message if the Receiver ever drops its connection. The platform-by-platform steps are in Can You Connect TradingView to MT4, MT5, and NinjaTrader 8?

Quick Checklist

Before your first live alert What it saves you from
Paid plan, 2FA on, and the Webhook URL field visible in the alert dialog. An alert that “fires” and goes nowhere.
Test the URL with a request-inspection service before pointing it at real money. A typo you only discover on the first trade that mattered.
If your receiver reads JSON, paste the message into a validator first. A trailing comma turning your JSON into plain text.
Your receiver answers inside three seconds even on a news bar. The cancelled request nobody retries.
The terminal is running when the alert can fire, or you know the trade is lost. Finding out on Monday from your P&L.
You know where “close” logic lives. It is not in the webhook. Dean’s question, asked at the worst possible time.

Everything in this article, the webhook, the Receiver on the chart and the log that tells you what happened, is in Nordman Connector. Five days of trial is long enough to fire a week of your own alerts through it.

Start Your 5-Day Free Trial →

Need a webhook receiver with your own rules, or a bridge into a platform we don’t list? We build to order → NinjaTrader Developers

Sources referenced in this article:

  1. TradingView. “How to configure webhook alerts.” TradingView Support: tradingview.com
  2. TradingView. “What do errors mean when sending webhooks?” TradingView Support: tradingview.com
  3. MQL5 forum, “Webhook url with mt4”, Jul 2021 — posts by Suhas Patil (#0), Alain Verleyen, moderator (#7), Lorentzos Roussos (#6): mql5.com/en/forum/374359
  4. MQL5 forum, “How to close a position from a webhook”, Sep 2022 — post by Dean-Trades (#0): mql5.com/en/forum/432127
  5. Nordman Algorithms. Nordman Connector, product documentation and internal latency measurements: nordman-connector.com

Nordman Algorithms provides software infrastructure for trade automation and does not offer financial advice, trading signals, or managed trading services. This article is for informational and educational purposes only. Forum quotations are reproduced verbatim from public threads for illustration and do not constitute endorsement. Trading leveraged instruments such as Forex, CFDs and futures carries a high level of risk and may not be suitable for all investors. Only risk capital should be used. Full Risk Disclosure: https://www.nordman-algorithms.com/risk-disclosure/