One of the most common questions from traders new to automation: "How does a TradingView alert actually trigger an MT5 Expert Advisor?" The answer involves a clever combination of TradingView webhooks, a local Node.js server, and an MT5 EA that polls that server over HTTP. This article breaks down the exact technical architecture used by TradingView Copier Pro.
What Is a TradingView Expert Advisor Setup?
In the context of TradingView-to-MT5 automation, a "TradingView Expert Advisor" setup means:
- A TradingView alert fires and sends a webhook (HTTP POST)
- A local server receives the webhook and parses the JSON command
- An MT5 Expert Advisor polls that local server over HTTP every half second
- The Expert Advisor picks up the trade command and executes it via MT5's built-in trade functions
The MT5 side uses a standard MQL5 Expert Advisor — the TV_Copier EA that comes with TradingView Copier Pro. According to MetaQuotes' MQL5 trading documentation, EAs have full access to the OrderSend() and PositionClose() functions, which is what the TV_Copier EA uses through MQL5's standard trade class.
The Full Execution Pipeline — Step by Step
TradingView Alert Condition Met
Your indicator crosses a level, your strategy fires an entry signal, or your custom condition evaluates true
Webhook POST Sent
TradingView sends an HTTP POST request with your JSON message to your Cloudflare tunnel URL (e.g. https://abc.trycloudflare.com/webhook)
Local Server Receives
TradingView Copier Pro's Express server receives the POST, validates the JSON, and logs the received signal
EA Polls the Local Server
The TV_Copier Expert Advisor asks the app's local server (http://127.0.0.1:3000) for new signals every half second, using MT5's built-in WebRequest over HTTP, and picks up the parsed command
MT5 Order Execution
The TV_Copier EA calculates the lot size from your risk setting and sends a market order through OrderSend(). MetaTrader 5 sends the order to your broker's server, and the fill depends on your broker and the market.
The TV_Copier Expert Advisor: What It Does
The TV_Copier.mq5 EA that TradingView Copier Pro installs into MT5 is responsible for:
- Signal polling — asks the app's local server for new commands every half second (HTTP WebRequest)
- Command parsing — reads the action, symbol and stop price, and calculates the lot size from your risk setting
- Symbol validation — checks the symbol exists and is tradeable in MT5
- Order execution — calls MT5's native trade functions with the correct parameters
- Error handling — returns error codes back to the app for logging if execution fails
The EA must be attached to at least one chart in MT5, the Algo Trading button must be enabled (it turns green in the toolbar), and http://127.0.0.1:3000 must be on MT5's allowed WebRequest list (Tools → Options → Expert Advisors). Without these, MT5 blocks the EA from trading or from reaching the app.
Why Local HTTP Polling
The EA and the app talk over local HTTP on your own PC. Here is how that compares with other ways of getting a command into MT5:
- File-based (common in DIY setups): EA polls a shared file every few seconds — can add 1–5 seconds of delay
- HTTP API to MT5: MT5 doesn't natively expose an HTTP API — requires additional middleware
- Local HTTP polling: No shared files and no DLLs — the EA polls the app's local server, and the app passes a trade to MT5 in under a second after the alert arrives
🔧 Technical note: The TV_Copier EA uses MQL5's WebRequest() function on a half-second timer to poll the app's local server at http://127.0.0.1:3000. This is a built-in MQL5 feature, not a workaround — which is why that address has to be on MT5's allowed WebRequest list.
What the EA Doesn't Do
It's worth being clear about what the EA doesn't handle:
- The EA doesn't make any strategy decisions — it executes the signals it's given, sizing each trade from your risk setting
- The EA doesn't connect to TradingView directly — that's the app's job
- The EA talks to the app, not to the internet — all communication between them is local
- One EA instance handles any symbol, any timeframe — you only attach it to one chart
EA Configuration Settings
When you attach the TV_Copier EA to a chart, you'll see input parameters including:
ServerURL— the address of the app's local server (default: http://127.0.0.1:3000, must match the app)MagicNumber— a unique ID stamped on orders from this EA (useful for identifying trades)PollIntervalMs— how often the EA checks the app for new signals (default: 500, which is every half second)
Get the TV_Copier Expert Advisor — Auto-Installed
TradingView Copier Pro installs the EA automatically. No MQL5 coding or manual file copying needed.
Get TradingView Copier Pro →Troubleshooting the Expert Advisor Connection
- EA not found in MT5 Navigator: Press Ctrl+D, go to Expert Advisors, right-click → Refresh
- EA attached but "algo trading disabled": Click the Algo Trading button in the MT5 toolbar — it should turn green
- EA can't reach the app: Check that TradingView Copier Pro is running and that the EA's ServerURL input matches the app's local address (http://127.0.0.1:3000)
- WebRequest error in the Experts tab: In MT5, go to Tools → Options → Expert Advisors, check "Allow WebRequest for listed URL", and add http://127.0.0.1:3000
For more troubleshooting help, visit our support page or read our complete webhook URL EA guide.
Frequently Asked Questions
Is there a TradingView Expert Advisor?
Not natively — EAs are MetaTrader technology and Pine Script is TradingView technology. The 'TradingView EA' traders talk about is an MT5 Expert Advisor that executes TradingView webhook alerts, bridging the two platforms.
How does a webhook EA differ from a normal MT5 EA?
A normal EA contains the strategy logic and decides trades itself. A webhook EA contains no strategy — it listens for instructions from your TradingView alerts and executes them. Your strategy stays in Pine Script where you can backtest it visually.
Can a webhook EA manage stop loss and take profit?
It depends on the EA. Some webhook EAs attach SL/TP at order placement. The TV_Copier EA does not attach a stop loss or take profit at the broker by default: it uses the stop price in the alert to calculate position size, and exits — including partial closes — are sent by your strategy's close alerts.