How to Connect TradingView to MT5 (Automated, No Coding)
TradingView can't place trades in MetaTrader 5 on its own. To automate it, a TradingView alert sends a webhook to a bridge service, and an Expert Advisor (EA) running in your MT5 terminal turns that message into an order. With TradingView Link, you create a webhook, install the EA, allow WebRequest, and paste the webhook URL into your alert.
This guide walks through the whole setup: what you need first, the seven setup steps, alert messages you can copy, and what to check when a trade doesn't go through. Test everything on a demo account before you trade real money.
What do you need before you start?
| You need | Why |
|---|---|
| A paid TradingView plan | Webhook notifications are included from the Essential plan up (Essential, Plus, Premium and higher) and aren't available on TradingView's free plan. TradingView pricing |
| 2-factor authentication on TradingView | TradingView only allows webhook alerts when 2-factor authentication is enabled on your account. TradingView help |
| MT5 on a Windows PC or VPS | The EA runs inside your MT5 desktop terminal, so the terminal has to stay open and connected. A VPS keeps it running 24/7. |
| An MT5 broker account | Demo, live or prop-firm. Start with a demo account. |
| A TradingView Link account | The free plan (5 alerts a month) is enough to test the setup. |
How does the TradingView to MT5 connection work?
- Your TradingView strategy or indicator triggers an alert.
- TradingView sends the alert message to your TradingView Link webhook URL.
- The TradingView Link EA in your MT5 terminal picks up the instruction and opens, modifies or closes the order with your broker.
How fast that happens depends on your plan: about 20 seconds on Free, about 3 seconds on Basic, about 1 second on Standard and under a second on Pro. One EA attached to a single chart manages every symbol in your Market Watch, so you don't need an EA per symbol.
How do you connect TradingView to MT5, step by step?
Step 1: Create an MT5 webhook in TradingView Link
Sign in to the dashboard, select or create a webhook for your MT5 account, and copy its webhook URL and webhook ID.
Step 2: Download and install the MT5 EA
Download the MT5 EA from the dashboard. In MT5, open File → Open Data Folder,
go to MQL5/Experts, paste the EA file, then refresh the Navigator or restart MT5.
Step 3: Allow algo trading and WebRequest
In Tools → Options → Expert Advisors, enable algorithmic trading and DLL
imports, and add https://tradingviewlink.com to the URLs allowed for WebRequest.
Make sure the Algo Trading button in the toolbar is green.
Step 4: Attach the EA and paste your webhook ID
Drag the EA onto one chart, allow algo trading in its properties, and paste your webhook ID into the inputs. Keep the other settings at their defaults for now.
Step 5: Generate your webhook password
In the dashboard, click Add Secret for this webhook. Every alert message must start with this password on its first line, so keep it safe.
Step 6: Create the TradingView alert
In TradingView, create an alert on your strategy or indicator. In the alert's notifications, turn on Webhook URL and paste your TradingView Link webhook URL. Write the message in the format shown below.
Step 7: Fire a test alert on demo
Trigger the alert and check that the order appears in MT5, in the Trade tab and the Experts log. Then send a close alert to confirm exits work too.
What should the alert message say?
Every message starts with your webhook password on the first line. Each line after that is one
instruction: the action, the symbol, the size (q=) and any optional settings.
Buy 0.1 lots of BTCUSD with a stop loss and take profit:
YourWebhookPassword
long BTCUSD q=0.1 sl=1000 tp=300 Let a Pine Script strategy send its own direction:
YourWebhookPassword
{{strategy.order.action}} BTCUSD q=0.06 slp=40000 tp=1000 Close every open US500 position:
YourWebhookPassword
flat US500 Tag a strategy with a magic number so several strategies can trade the same symbol:
YourWebhookPassword
long BTCUSD q=0.1 sl=300 tp=600 m=1001 slandtpare distances in pips; useslpandtppfor exact prices, or add%for a percentage, such astp=3%.- The symbol must match your broker's name exactly, including any suffix your broker adds.
- Limit orders, trailing stops, trading sessions and partial closes are covered in the full documentation.
What should you check before going live?
- Run every alert on a demo account first and compare the fills with what you expected.
- Check the symbol name, lot size and stop distances for each instrument you trade.
- Keep MT5 running on your PC or a VPS, with the Algo Trading button green.
- Use magic numbers (
m=) when several strategies trade the same symbol. - On a prop-firm account, read the firm's rules on Expert Advisors before you start.
TradingView to MT5 not working? Quick fixes
| Problem | What to check |
|---|---|
| No trades at all | The Algo Trading button is green, https://tradingviewlink.com is in the
WebRequest list, and the webhook ID in the EA matches the webhook URL in your alert. |
| The alert fires but nothing happens | The password is on the first line, the symbol matches your broker's name exactly, and
the action and q= follow the syntax above. |
| WebRequest or connection errors | WebRequest and DLL imports are allowed, and no firewall or VPS rule blocks outbound connections from MT5. |
| TradingView won't save the webhook | Turn on 2-factor authentication, and check that your plan includes webhooks. |
How much does it cost?
| Plan | Price | Alerts | Typical latency | Also includes |
|---|---|---|---|---|
| Free | $0 | 5 alerts per month | ~20 seconds | Enough to test your setup |
| Basic | $4.99/month | 500 alerts per day | ~3 seconds | Telegram trading & alerts, webhook dashboard |
| Standard | $9.99/month | 3,000 alerts per day | ~1 second | Telegram, webhook dashboard, alert logs |
| Pro | $19.99/month | 7,000 alerts per day | Sub-second | Alert sharing, Telegram, webhook dashboard, alert logs |
Every plan works with both MT4 and MT5. Paid plans start with a 7-day free trial; if you don't subscribe when it ends, your account moves to the free plan. New subscriptions come with a 30-day money-back guarantee.
Frequently asked questions
Can TradingView connect to MT5 directly?
No. TradingView has no built-in link to MetaTrader 5. To trade automatically you need a webhook bridge plus an Expert Advisor (EA) running in your MT5 terminal, which is what TradingView Link provides.
Do I need a paid TradingView plan?
Yes. Webhook notifications are included from TradingView's Essential plan up and aren't available on the free plan. TradingView also requires 2-factor authentication on your account before it sends webhook alerts.
Does my computer have to stay on?
Yes. The EA runs inside your MT5 terminal, so MT5 has to be open and connected for trades to be placed. Many traders run MT5 on a Windows VPS so it stays online 24/7.
Can I automate a Pine Script strategy?
Yes. Put a placeholder such as {{strategy.order.action}} in the alert message so the strategy sends its own direction, or create separate alerts for entries and exits.
How fast are trades placed?
It depends on your plan: about 20 seconds on Free, about 3 seconds on Basic, about 1 second on Standard and under a second on Pro. Your broker's own execution time comes on top.
Does it work with prop-firm accounts?
TradingView Link works with demo, live and prop-firm MT5 accounts. Every firm has its own rules on Expert Advisors, so check them before you connect a funded account.
Is there a free plan?
Yes. The free plan includes 5 alerts a month, which is enough to test your setup. Paid plans start at $4.99 a month and begin with a 7-day free trial. No credit card is required.