Ready to go further
Next: the whole chain from chart to broker
The TradingView bot guide covers each link, a test plan to run before any real money is used, and what a backtest cannot tell you.
What is included
- What it is, in plain words
- The formula or mechanism, with exact arithmetic
- How it hits grid, martingale and DCA bots
- A check you can run before you switch a bot on
Who it is for
- People who run or plan to run a trading bot
- Anyone reading a backtest or a bot sales page
- Readers who want the numbers, not the pitch
- Not advice, and not a signal service
Key facts
- The idea: a chart condition becomes true, the charting site sends a short message to a web address (a webhook), a small program there reads it, and the program asks a trading platform such as MT5 to place an order. Each hop is a separate system.
- Each hop can fail in its own way: the message is late, arrives twice, names the wrong symbol, asks for the wrong size, or reaches a platform that is closed or disconnected.
- In a made-up chain the delay from alert to order is 2.5 seconds on a usual run and 16.0 seconds on a slow run. At a made-up drift of 0.02 a second on 10 units, that is $0.50 and $3.20 (calculated by us on 30 Oct 2026, exact).
- The safe parts are checks, not features: a shared secret, a duplicate filter, a size cap, a status check and a log you can read afterwards.
- Setup menus and options differ by site and by version, so this page describes ideas and does not give a recipe.
The idea in one picture
A webhook is a web address that accepts a short message. A charting site can be told to send one when an alert fires. The TradingView alerts page covers the alert side. This page covers what comes after the message leaves: a small program, the receiver, picks it up and turns it into an order on a trading platform. MT5 is one such platform. The same idea applies to any platform that lets a program send orders.
The TradingView bot page walks the whole chain from the chart to the broker. Here we take the middle and the end: the receiver and the hand-off to the platform. Think of five steps in a row.
- The alert fires on the charting site.
- The site sends the webhook message.
- The receiver reads it, checks it and decides what to do.
- The receiver passes an order to the platform, often through a small program that runs inside it or beside it.
- The platform sends the order to the broker, and the broker fills or rejects it.
The chart knows nothing about your account. The receiver knows nothing about the chart beyond the message. The platform knows nothing about either. Every fact that crosses a boundary has to be written into the message and checked on the other side.
A made-up latency table
Latency is the time between two events. Below, a made-up chain is timed at each stage in two runs: a usual one and a slow one. The seconds are invented to show how delays add up. They are not measurements of any product. The last row assumes price drifts against the order by 0.02 a second, which is also made up, on 10 units.
| Stage | Usual run (seconds) | Slow run (seconds) |
|---|---|---|
| Alert condition met and sent | 1.0 | 6.0 |
| Webhook delivered to the receiver | 0.6 | 4.0 |
| Receiver reads and checks the message | 0.1 | 0.5 |
| Receiver hands the order to the platform | 0.5 | 3.0 |
| Platform sends the order to the broker | 0.3 | 2.5 |
| Total | 2.5 | 16.0 |
| Price drift against you (0.02 a second, 10 units) | $0.50 | $3.20 |
Two things stand out. First, no single stage is the whole delay. The slow run is slower at every step, and 16.0 seconds is the sum. Second, the cost is the delay times the drift, so it grows with both. A 2.5 second chain costs $0.50 in the example and a 16.0 second chain costs $3.20, which is 6.4 times as much. A rule that needs the price at the moment of the alert gets a different price. See slippage.
How each step fails
The table lists a failure for each step. Most of them look fine at the step where they start and show up later, at the platform.
| Step | Failure | What you see | A guard |
|---|---|---|---|
| Alert | Late, missed or sent twice | Order placed late, never, or twice | Remember each alert id and ignore repeats |
| Webhook | Message lost or retried | Missing exit, or a second entry | Reply fast, return a clear result, log every call |
| Receiver | Offline or slow, bad text | Nothing happens, or a wrong order | Check a shared secret and the message format |
| Symbol name | The chart name differs from the platform name | Order rejected or the wrong market | Keep a written map of names and test each one |
| Lot size | Chart units differ from platform lots | Order far too big or too small | Convert in one place and cap the size |
| Platform | Closed, disconnected or market shut | Order rejected, stale position | Check status first, alert yourself on any failure |
Delay
Everything above takes time. If the rule needs a price right now, a few seconds is a different price. A rule built on closed bars is more forgiving than a rule built on a tick.
Duplicate
A sender that does not get a quick reply may send again. A receiver that does not remember what it has seen will place two orders. Each message needs an id, and the receiver must ignore an id it has handled.
Wrong symbol name
The name on the chart is not always the name on the platform. A platform may add a suffix, drop a character or use another code for the same market. Send a name the platform does not know, and the order is rejected. Send a name it knows for a different market, and the order is real. Keep a written map and test every name.
Lot size
A chart says "10 units". A platform may want "0.10 lot", and what one lot means varies by market and by broker. Do the conversion in one place, show the result in the log, and cap the largest order the receiver may send. See lot size calculator.
Platform closed
The market may be shut, the platform may be logged out, or the connection may have dropped. The message arrives and nothing can use it. The receiver should check the platform's status before it sends, and tell you when it cannot.
A safety checklist before any real order
- Test on a demo account first. See demo account and paper trading.
- Put a shared secret in every message and reject any that lack it.
- Give each message an id, and ignore repeats.
- Cap the order size and the number of orders per day in the receiver, not only on the chart.
- Use a platform login that can trade but not withdraw, if the broker allows it.
- Keep a written list of symbol names and lot conversions.
- Log every message, every decision and every reply from the platform, with a time.
- Close any position that has no stop, and have a stop that does not rely on the next message.
- Send yourself a notice when the receiver fails or the platform is closed.
- Treat the webhook address as a password. Do not share it.
All numbers here are made up. This page is education about how a chain of systems can fail. It is not a guide to setting one up.
Keep Going
Related Tools and Guides
Keep exploring
FAQ
Frequently Asked Questions
What is a TradingView webhook?
It is a web address that receives a short message when a chart alert fires. A program listening there can read the message and decide what to do with it.
How does a webhook reach MT5?
Not directly. A small program receives the message, checks it, and passes an order to the platform. The details differ between tools, so check the documentation of whatever you use.
Why was my order late or doubled?
Each hop adds delay, and a sender may retry when it gets no quick reply. A receiver that remembers message ids and ignores repeats avoids the double.
Why was an order rejected for the symbol?
The name on the chart can differ from the name on the platform. Keep a written map of names and test each one on a demo account first.
What should a webhook receiver always check?
A shared secret, a message id it has not seen, a valid size under a cap, and that the platform is open and connected. It should log every step.
Are the numbers on this page real?
Example numbers are made up to show how the maths works, and the page says so. A figure only counts as exact when the page says it was calculated on a stated date. Nothing you enter in a calculator leaves your browser.
Can I use this to decide whether to run a bot?
It can show whether a bot's numbers hold together and how much an account can lose. It cannot say what the market will do, and it is not advice. Use it to ask better questions, then read the terms of your own broker or exchange.
Is this financial advice?
No. It is general education about how a chain of systems works and fails. The numbers are made up, and it does not consider your situation.
Know the Risk Before You Run It
Free calculators and guides, added every week. Leave your details and we will email you when new ones go up.
Trading carries a risk of loss