Home › Guides › TradingView Webhook to MT5

TESTING TRAPFREENO ACCOUNTAUTOMATED TRADE BOTSTradingView Webhookto MT5Why a good backtest can lieEDUCATION ONLY | NO SIGNALSEXAMPLE NUMBERS ARE LABELLEDAUTOMATED TRADE BOTSautomatedtradebots.com
A free page on tradingview webhook to mt5. Education only, with example numbers labelled.
TESTING TRAP

TradingView Webhook to MT5

Short answer

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.

An alert sends a message, a small program reads it and asks the platform for an order. Each hop can be late, doubled or wrong.

The page explains the idea in plain words, works through the arithmetic with a table, and shows how it hits grid, martingale and DCA bots, then tells you what to check before you run one.

  • A worked example with real arithmetic
  • How it hits grid, martingale and DCA bots
  • How to check for it before you run a bot
  • No advice, no signals, no profit promises

Last reviewed 28 October 2026. Education only, not advice.

Free, no account Runs in your browser Worked numbers shown Not advice Examples labelled

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.

Read the chain guideFree, no account
Reading time6 minutes
Worked exampleExact arithmetic
Tools linked1 on this page
Reviewed28 Oct 2026

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
Made-up delay from alert to order, by stage (usual run, seconds)1.0Alertseconds0.6Deliveryseconds0.1Checkseconds0.5Hand-offseconds0.3To brokersecondsA made-up example. Total 2.5 seconds in a usual run. Not a measurement of any real system.
The picture for this page. Example numbers are made up unless the page says they were calculated.

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.

  1. The alert fires on the charting site.
  2. The site sends the webhook message.
  3. The receiver reads it, checks it and decides what to do.
  4. The receiver passes an order to the platform, often through a small program that runs inside it or beside it.
  5. 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.

StageUsual run (seconds)Slow run (seconds)
Alert condition met and sent1.06.0
Webhook delivered to the receiver0.64.0
Receiver reads and checks the message0.10.5
Receiver hands the order to the platform0.53.0
Platform sends the order to the broker0.32.5
Total2.516.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.

The same chain on a usual run and a slow run (made-up seconds)2.5Usual runtotal seconds16.0Slow runtotal secondsA made-up example. Every stage is slower on the slow run, and the delays add up.
The same chain on two runs. The slow run takes more than six times as long, because every stage slows down together.

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.

StepFailureWhat you seeA guard
AlertLate, missed or sent twiceOrder placed late, never, or twiceRemember each alert id and ignore repeats
WebhookMessage lost or retriedMissing exit, or a second entryReply fast, return a clear result, log every call
ReceiverOffline or slow, bad textNothing happens, or a wrong orderCheck a shared secret and the message format
Symbol nameThe chart name differs from the platform nameOrder rejected or the wrong marketKeep a written map of names and test each one
Lot sizeChart units differ from platform lotsOrder far too big or too smallConvert in one place and cap the size
PlatformClosed, disconnected or market shutOrder rejected, stale positionCheck 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.

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