Back to guides
SETUP GUIDE

How to Connect TradingView Alerts to MT5 Automatically (2026 Guide)

June 2026

8 min read

Table of Contents
  1. 01Why TradingView Cannot Talk to MT5 Directly
  2. 02How TradingView Webhooks Work
  3. 03What You Need Before Starting
  4. 04Setting Up TradingView to MT5 with PilotFX
  5. 05The Four Most Common Setup Mistakes
  6. 06What Happens When MT5 Disconnects
  7. 07Running Multiple Signal Sources on the Same MT5 Account
  8. 08Which Approach Fits Your Setup
  9. 09Frequently Asked Questions

TradingView fires the alert. MT5 sits there doing nothing.

That gap between signal and execution costs traders money every day — not because their strategy is wrong but because nobody told the broker about it. You are either watching a screen or missing the entry. In fast-moving markets like XAUUSD, a 30-second delay turns a clean entry into chasing price. A 5-minute delay is a missed trade.

In 2026, closing that gap takes about 10 minutes to set up. This guide walks through exactly how it works — the architecture, the webhook format, the common mistakes and what happens when something goes wrong overnight.

1. Why TradingView Cannot Talk to MT5 Directly

TradingView and MetaTrader 5 were built by different companies for different purposes. TradingView is a charting and analysis platform running on Pine Script. MT5 is an execution platform running on MQL5. They speak entirely different languages and there is no native connection between them.

MT5 has no inbound webhook support. It is a desktop application that communicates with brokers through its own proprietary protocol. Pointing a TradingView alert at an MT5 terminal IP address does nothing — MT5 is not listening.

The fix is a relay layer. A cloud service that accepts your TradingView webhook, reads the signal, applies your risk settings and forwards the trade instruction to an Expert Advisor running inside MT5. The EA places the order using MT5's native order functions. Your broker fills it.

Three components. TradingView sends. The relay processes. MT5 executes.

2. How TradingView Webhooks Work in Automated Forex Trading

When an alert condition triggers in TradingView — a Pine Script strategy signal, an indicator crossover, a price level hit — TradingView sends an HTTP POST request to a URL you specify. The body of that request is whatever you put in the alert message field. For automated trading, that message is JSON containing your trade parameters.

The execution chain for TradingView MT5 webhook automation:

Pine Script alert condition met
        ↓
TradingView sends JSON payload (~50ms)
        ↓
Relay receives and validates signal (~50ms)
        ↓
Trade instruction forwarded to MT5 EA (~50ms)
        ↓
Broker fills the order (~50ms)
        ↓
Confirmation logged, Telegram notification sent

End-to-end latency from TradingView alert to broker fill runs approximately 200ms with a well-configured relay setup. PilotFX averages 247ms signal-to-fill including the full broker execution round trip. For context, the London open spike on XAUUSD moves 30 pips in under 3 seconds. At 247ms you are in before most manual traders have reached their keyboard.

One thing worth knowing about TradingView alert timing: alerts fire at bar close by default, not at the tick the condition is met. For a 1-hour chart, your signal executes when the candle closes, not when the indicator crosses mid-bar. For most swing and position traders this is correct behaviour. Scalpers on 1-minute charts need to set alerts to fire on every tick, which sends a webhook on each tick — worth understanding before setting up automation.

3. What You Need Before Starting

TradingView paid plan

Webhooks require TradingView Essential or higher at approximately $15 per month. The free plan and Basic plan cannot send webhook alerts — only email and push notifications. If you are on a free plan, upgrading to Essential is the minimum requirement before any of this works.

MT5 terminal with a connected account

Live account, demo account or prop firm challenge account — the setup is identical. PilotFX works with any MT5 broker worldwide. If your broker offers MT5, the integration works.

PilotFX account

The relay layer. Receives your TradingView webhooks, validates signals against your risk settings, routes trades to your MT5 EA. Runs in the cloud with no VPS or local machine required to stay on. The 7-day free trial includes everything — FTMO Mode, news pause, break-even trailing stop, multi-source signals.

4. Setting Up TradingView to MT5 Webhook — Step by Step

Step 1 — Register at PilotFX

Go to pilotfx.io and create an account. The free trial starts immediately with no credit card required.

Step 2 — Install the PilotFX EA on MT5

From your PilotFX dashboard, download the Expert Advisor file. In MT5:

  1. Press Ctrl+N to open the Navigator panel
  2. Right-click Expert Advisors → Open Folder
  3. Copy the PilotFX EA file into the MQL5/Experts folder
  4. Press F5 to refresh or restart MT5
  5. Drag the EA onto any chart
  6. Enable Algo Trading in the MT5 toolbar

That last point catches most traders the first time. Algo Trading is a toggle in the MT5 toolbar and it must be active. Without it, MT5 blocks all incoming automated instructions regardless of whether the EA is installed correctly. Some MT5 updates reset this setting — if signals stop executing unexpectedly, check here first.

The EA auto-reconnects on every new MT5 session. After initial installation you do not touch it again.

Step 3 — Get your webhook URL

In PilotFX Settings, copy your unique webhook URL:

https://api.pilotfx.io/webhook/tradingview

This is the URL you paste into TradingView. Each PilotFX account has its own endpoint — signals are routed to your specific account and MT5 connection.

Step 4 — Configure the TradingView alert

In TradingView, open the alert dialog (right-click any chart or indicator → Add alert). In the Notifications tab, enable Webhook URL and paste your PilotFX URL.

In the Message field, enter your signal payload. Basic format:

{
  "symbol": "XAUUSD",
  "side": "BUY",
  "sl": 2340.00,
  "tp": 2375.00,
  "secret": "your-webhook-secret"
}

Complete field reference:

FieldRequiredDescription
symbolYesTrading instrument — use your broker's exact symbol name
sideYesBUY or SELL
slYesStop loss price level
tpNoTake profit price level
tp2NoSecond take profit for scaling out
entryNoSpecific entry price — uses market price if omitted
risk_modeNoPosition sizing method: "fixed", "percent" or "risk"
risk_percentNoPercentage of account balance to risk
account_idNoTarget MT5 account when running multiple accounts
secretNoWebhook authentication key from PilotFX settings

For percentage-based position sizing — recommended for funded accounts where lot size needs to scale with balance:

{
  "symbol": "XAUUSD",
  "side": "BUY",
  "sl": 2340.00,
  "tp": 2375.00,
  "risk_mode": "risk",
  "risk_percent": 1.0,
  "secret": "your-webhook-secret"
}

PilotFX calculates the correct lot size from your current account balance and the distance between entry and stop loss. If your balance changes, the next trade sizes correctly without any manual adjustment.

Using Pine Script variables in your alert message to pull real-time values:

{
  "symbol": "{{ticker}}",
  "side": "{{strategy.order.action}}",
  "entry": {{close}},
  "sl": {{strategy.order.stop}},
  "tp": {{strategy.order.limit}},
  "risk_mode": "risk",
  "risk_percent": 1.0,
  "secret": "your-webhook-secret"
}

The double-brace syntax is replaced by TradingView with live values when the alert fires. {{ticker}} becomes XAUUSD, {{strategy.order.action}} becomes buy or sell, and so on.

Step 5 — Test before going live

Trigger your alert manually in TradingView using the Test button. Check your PilotFX signal log — every incoming signal is logged with timestamp, symbol, direction, lot size and execution status. A trade should appear in MT5 within 300ms.

If the trade does not appear, the signal log shows exactly why. PilotFX logs every rejection with the specific reason — missing required field, validation failure, news pause active, FTMO daily limit reached. Fix the issue the log points to, test again.

Always test on a demo account before connecting a live or prop firm account. Run at least 10 test signals across different scenarios before trusting it with real capital.

5. The Four Most Common TradingView MT5 Webhook Setup Mistakes

Algo Trading is disabled in MT5

The most common reason signals arrive at PilotFX but nothing executes in MT5. The Algo Trading button in the MT5 toolbar must be enabled. It is easy to miss after a platform update resets it. Check this first when trades stop executing unexpectedly.

Wrong symbol name

MT5 brokers format symbols differently. FTMO uses XAUUSD. Some brokers use GOLD, XAUUSDm or XAU/USD. Open your MT5 Market Watch window and copy the exact symbol string from there. Paste it directly into your alert payload. A one-character mismatch causes every signal to fail.

Alert triggering on every tick instead of bar close

Tick-based alerts fire dozens of times per candle. Each one sends a webhook to PilotFX, each webhook queues a trade execution. On a volatile instrument during high-impact news you can accumulate 50 queued signals in 10 seconds. Set the alert to trigger on bar close for strategy-based automation.

Calculating stop loss in Pine at alert time instead of using risk mode

Using {{close}} - 50 to calculate a stop loss in Pine locks in the price at the moment the alert fires. By the time PilotFX receives the signal, the relay processes it and MT5 fills the order, price has moved. Use risk_mode and risk_percent instead — PilotFX calculates the lot size from the actual fill price, not the Pine close at alert time.

6. What Happens When MT5 Disconnects

Overnight disconnections happen. MT5 restarts, internet drops briefly, VPS reboots. A signal that fires during a disconnection window cannot execute if the relay has nowhere to send it.

PilotFX handles this through its task queue. When a signal arrives and MT5 is unreachable, the execution task queues via the backend task system and processes as soon as the connection restores. You receive a Telegram notification the moment a disconnection is detected — not when you check the dashboard next morning, immediately.

Two things to know about queued signals. First, the queue processes in order — signals that arrived during the disconnection execute in sequence when the connection restores. Second, if the disconnection happens during a news spike and the market has moved 200 pips by the time MT5 reconnects, those queued signals execute at the current market price, not the price when the signal fired. The news pause feature blocks new signals during high-impact events to prevent exactly this scenario.

7. Running Multiple Signal Sources on the Same MT5 Account

A TradingView webhook setup handles TradingView signals. Most active traders use more than one source.

PilotFX routes TradingView webhooks, Telegram signal group messages and Discord channel posts through the same execution pipeline to the same MT5 account. You do not set up three separate integrations. The account is configured once. All three sources execute against the same risk settings, the same FTMO limits, the same position monitoring.

Practical example: EURUSD runs from a TradingView Pine Script strategy via webhook. XAUUSD comes from a Telegram signal group. NASDAQ comes from a Discord trading community. All three execute on the same MT5 account simultaneously with independent risk rules per symbol.

8. Which Approach Fits Your Setup

There are several ways to connect TradingView to MT5 for automated forex trading. Each has a different cost in time, money and reliability.

Build your own relay (Python or MQL5)

Free, full control, no monthly fee. You also volunteer to be your own infrastructure team at 3am when the connection drops. Requires a machine or VPS running 24/7. No built-in monitoring, no dashboard, no alerts. Worth doing if you want to understand the architecture. Not worth doing if you want reliable 24/5 execution.

Windows-only EA bridge service

Works well if you have a Windows machine or VPS already running. Ties you to that machine — Mac traders need an additional Windows VPS which adds cost. Most do not include FTMO rule enforcement, news pause or multi-source signals. Fine for straightforward TradingView-only setups.

Cloud relay — PilotFX

No VPS, no Windows requirement, no local machine needed. Runs continuously regardless of what your computer is doing. Includes real-time signal log, Telegram notifications on execution and disconnection, FTMO Mode for funded account rule enforcement, news pause around high-impact events and break-even trailing stop management. One setup covers TradingView, Telegram and Discord simultaneously.

The monthly fee is the tradeoff. At $24 per month for the Starter plan, you are paying roughly $0.16 per execution on 150 trades. If your strategy is profitable, the execution reliability is worth more than the subscription cost.

Frequently Asked Questions

Do I need a paid TradingView plan to use webhooks?

Yes. TradingView Essential or higher is required. The Essential plan starts at approximately $15 per month. The free and Basic plans do not support webhook alerts — only email and push notifications.

Does TradingView webhook automation work with FTMO and other prop firm accounts?

Yes. PilotFX works with any MT5 broker including FTMO, Funded Next, MyForexFunds, E8 Funding and The Funded Trader. FTMO Mode on Pro and Master plans enforces your challenge daily loss and drawdown limits automatically — entries block as you approach a limit, trading halts at the limit.

What is the difference between webhook alerts and email alerts for trading?

Webhook alerts send a structured JSON payload to a URL and receive a response within milliseconds. Email alerts send a plain text message through an email server, which introduces delays of 5–60 seconds depending on server load. For automated trading, webhooks are the only practical option.

Can I send the same TradingView alert to multiple MT5 accounts?

Yes. Include the account_id field in your payload to target a specific account. On the Pro plan you can run 2 MT5 accounts simultaneously. The Master plan supports unlimited accounts, each with independent signal routing and risk settings.

What if I want to scale out of a position at two different take profit levels?

Use the tp field for your first target and tp2 for the remainder. PilotFX closes a portion of the position at tp and moves the stop to break-even, then lets the rest run to tp2. Configure the split percentage in your dashboard settings.

How do I verify my webhook is working before going live?

Use the Test button in TradingView's alert dialog to manually trigger the webhook without waiting for a real signal. Check your PilotFX signal log immediately after — the log shows whether the signal arrived, whether it passed validation and whether the trade executed. A demo account lets you run 20–30 test signals with zero risk before connecting your live or prop firm account.

Start your 7-day free trial at pilotfx.io — no credit card required.

The first signal takes about 10 minutes to set up. After that it runs on its own.

Get started

Ready to automate your signals?

7-day free trial. No credit card required. Works with any MT5 broker.

Start free — no card needed