Guide

TradingView Alerts to MT5 Webhook for UAE Traders: How the Chain Works

MetaTrader 5 can't take an incoming web request, so any TradingView alerts to MT5 webhook for UAE traders setup puts a small server between the two. That server receives each alert, and an Expert Advisor (EA) inside MT5 fetches it and sends the order to your broker.

TradingView alert sent as a JSON webhook through a VPS listener to place a BUY order in MT5
On this page

TradingView alerts to MT5 webhook for UAE traders flow: chart alert, HTTPS webhook, VPS listener, MT5 EA and broker order

MQL5’s network functions connect out to servers and never wait for one to call in, so the EA has to ask for each signal.

Each link can fail on its own, so log each one:

  1. A Pine Script strategy or indicator fires an alert that carries a message.
  2. TradingView sends that message as an HTTP POST to your webhook URL.
  3. A listener on your VPS checks the message, replies and queues the signal.
  4. An EA in MT5 asks the listener for new signals on a timer and sends the order.

Since the EA does the fetching, the listener and MT5 can share one Windows VPS that keeps running after you close your laptop.

What TradingView requires before a webhook fires

Webhooks have been a paid feature since TradingView launched them in 2019. Check the current plan table before you pay, and switch on two-factor login.

Its help page on webhooks then puts four limits on the server that receives the call:

Limit What it means for your listener
Only ports 80 and 443 are accepted A listener on port 8080 never hears anything.
No IPv6 for webhooks yet The VPS needs an IPv4 address.
Requests come from four listed IP addresses Your firewall can drop traffic from anywhere else.
Three seconds to reply Take longer and TradingView cancels the request.

Alerts also expire. A standard alert lasts two months at most unless you pick the open-ended option on Premium or Ultimate, so one set in January can go quiet in March.

The alert message and the TradingView webhook JSON format

Paste your listener’s address into the Webhook URL field. There is no fixed TradingView webhook JSON format: your listener reads whatever fields you type. Keep it flat:

{
  "token": "change-this-secret",
  "symbol": "{{ticker}}",
  "side": "{{strategy.order.action}}",
  "lots": 0.10,
  "sl_points": 300,
  "tp_points": 600,
  "id": "{{strategy.order.id}}",
  "sent": "{{timenow}}"
}

When the alert fires, {{ticker}} turns into the chart symbol and {{strategy.order.action}} into the word buy or sell. {{timenow}} gives the fire time in UTC.

{{strategy.order.id}} returns the ID your script gave the order, such as Long, so the same value comes back on every long entry and on every chart. The listener treats a signal as a repeat only when symbol, ID and sent time all match.

Watch the commas. TradingView sends valid JSON with an application/json header and anything else as plain text, so one typo changes what your listener receives.

A listener that answers inside three seconds

The listener is a small web app, often written in Python, that waits for POST requests on port 443. It checks the token and the JSON in each request, queues a valid signal and replies.

Reply before doing anything slow, or a busy evening will push you past three seconds. If trades stop arriving, open the TradingView alert log first: its Webhook status column shows whether each request reached your server.

Five layers on one VPS: HTTPS endpoint on port 443, token and JSON check, signal queue with time stamps, MT5 EA, and logs with push alerts

Why the token goes inside the JSON

Anyone who finds your URL can post to it. The alert dialog only has a URL and a message body to fill in, so the secret token travels in the body and the listener drops any request without it.

Use HTTPS, and keep login details and passwords out of the body, as TradingView warns.

Fragile webhook setup with no token and a home PC listener next to a solid setup with a secret token, VPS, unique alert ID and logs

The EA polls the listener and places the order

A common pattern calls WebRequest() from OnTimer() to ask the listener for anything new. The call fails until you add the listener’s address by hand to the allowed URLs list under Tools, Options, Expert Advisors. Indicators can’t call it at all, so the bridge must be an EA.

EventSetMillisecondTimer() lets the timer tick faster than once a second, though in live mode MetaQuotes puts the floor at 10 to 16 milliseconds. A 250 millisecond poll is plenty.

Before it sends any order, the EA should:

  • map TradingView names to your broker’s, such as XAUUSD to XAUUSD.m,
  • round the lot to the broker’s lot step, then cap it at your max lot,
  • skip the trade when the spread is wider than your limit,
  • know whether the account is netting or hedging.
MT5 EA inputs panel with symbol map, lot mode, max lot, max spread, max signal age, magic number and push alerts
Example values only. Your broker's symbol suffix and lot step set the real ones.

What breaks, and how the bridge should respond

Settle these responses before you go live:

  • A crashed listener comes back by itself when it runs as a Windows service set to restart on failure.
  • After MT5 has been offline, the EA skips any signal older than your max age, for example 30 seconds.
  • A signal the listener has already handled never opens a second trade.
  • For a rejected order, the EA logs the return code and sends a push alert with SendNotification().
  • A message that isn’t valid JSON is rejected and logged.
Checklist of five bridge failures: listener down, MT5 offline, duplicate alert, rejected order and bad JSON
MT5 allows at most 10 push alerts a minute from SendNotification(), so send one per failure and none per retry.

Never replay old signals: a buy from 40 minutes ago, filled at today’s price, is not the trade your strategy picked.

Delay, and the US open in Dubai time

Time each hop on its own. {{timenow}} records when the alert fired; log when the request lands and when the order fills. Bar close alerts add their own wait, since they fire only when the candle closes.

US stocks open at 9:30 New York time. The UAE keeps one clock all year, so in Dubai that open falls at 17:30 from March to early November and at 18:30 during the US winter. In Riyadh it’s an hour earlier. Those evenings bring the most alerts, so pick a VPS that stays up through them.

WebRequest can’t run in the Strategy Tester, so test on demo

WebRequest() cannot run in the Strategy Tester, so test live on a demo account with your broker’s own prices and delays.

Run one symbol for a week and match each order to its alert. The bridge passes when every alert produced the right order, exactly once.

Send us one alert message and your symbol names

We build every part of this bridge: see our TradingView to MT4/MT5 copier, or ask a Pine Script developer for clean alerts. A Pine Script to MQL5 conversion can later move the strategy into MT5. For chat signals, read how to copy Telegram signals to MT5.

To start, send us one sample alert message and your broker’s symbol names, and we’ll tell you what the EA has to handle.

Sources

Frequently asked questions

Do I need a paid TradingView plan for webhook alerts?

A paid plan is needed, plus two-factor login. Plan names change, so check the Webhook notifications row in TradingView's pricing table before you subscribe.

Can TradingView connect to MT5 directly?

TradingView has no built-in link to MT5. You need a webhook to a server you control plus an EA that collects the alert.

Will MT5 trades match my TradingView backtest?

Expect small differences, because TradingView's data feed and backtest fills are not your broker's. Compare every demo trade with the alert that caused it.

Do I need a VPS for TradingView alerts to MT5 webhook for UAE traders?

Most setups do, since the listener needs a public IPv4 address and MT5 must stay online; one Windows VPS can run both.

What happens if an alert fires while MT5 is offline?

The listener keeps it with a time stamp, and on reconnect the EA drops it if it is older than your max signal age. Set that age from the hop times you measured on demo.

Can I send alerts from an indicator, not only a strategy?

Indicators can send JSON through alert() or alertcondition(). Strategy placeholders work only in strategy alerts, so an indicator writes the side and ID itself, for example as fixed text in each alertcondition().

WhatsApp · Email · Telegram

Tell us what you want to automate

Send your rules on WhatsApp. You get a clear quote, then a demo build to test before you pay in full.