Introduction
If you run an Expert Advisor (EA) or copy trades automatically, your MetaTrader terminal must stay online 24/7. Your home computer with its inevitable power outages, ISP hiccups, Windows updates, and accidental restarts is not reliable enough. A Virtual Private Server (VPS) solves this: it is a remote computer that runs your MetaTrader platform continuously, connected to your broker with low latency, independent of your local machine.
In this guide you will learn exactly how to select a VPS, install MetaTrader 4 or 5 on it, configure remote access, enable AutoTrading, and keep everything running smoothly. By the end you will have a production-ready setup that lets your EAs trade around the clock without you touching the keyboard.
Prerequisites
- A live trading or demo account with a MetaTrader 4 or MetaTrader 5 broker
- The login credentials (server, account number, investor/master password)
- A VPS subscription (see recommendations below) with Windows Server 2019/2022 or Windows 10/11
- Remote Desktop Connection (RDP) client on your local PC (built into Windows; use Microsoft Remote Desktop on Mac/iOS)
- Your EA files (.ex4/.ex5) and any custom indicators or DLLs, if applicable
Step-by-Step VPS Setup for MetaTrader
Step 1: Choose and Order a VPS
Not all VPS providers are equal for trading. The key specs are:
- CPU: At least 1 dedicated core (2 GHz or higher). Avoid shared "burstable" CPUs.
- RAM: 2 GB minimum for MT4/MT5 + Windows overhead. 4 GB if running multiple terminals.
- Storage: 30-50 GB SSD is plenty.
- Location: Choose a datacenter geographically close to your broker's trade server (ping under 10 ms ideal).
- Operating System: Windows Server 2019 or 2022 (recommended) or Windows 10/11 Pro.
| Provider | Typical Monthly Cost | Ping to Broker | Notes |
|---|---|---|---|
| Forex VPS (e.g. Fozzy, Beeks) | $20-$40 | < 5 ms | Optimized for MT4/MT5; often include pre-installed terminal |
| General Cloud (AWS, Vultr, DigitalOcean) | $10-$30 | < 10 ms | Requires manual setup; more flexible but more work |
| Broker-Provided VPS | Free with min deposit | < 1 ms | Check terms: often limited to one terminal, no custom software |
My recommendation: Start with a broker-provided VPS if available and free. Otherwise, use a dedicated forex VPS provider — the few extra dollars save hours of configuration time.
Step 2: Connect to Your VPS via Remote Desktop
After ordering, the provider sends you an IP address, username, and password. On Windows, press Win + R, type mstsc, and hit Enter. Enter the IP address and click Connect. Accept the certificate warning, then log in with the credentials.
Important: On first login, change the password immediately. Use a strong password (at least 12 characters with numbers and symbols).
Step 3: Install MetaTrader 4 or 5
Inside the VPS, open a browser (Edge or Chrome), go to your broker's website, and download the MT4 or MT5 installer. Run the installer with default options. After installation, launch the terminal and log in with your account credentials:
- In MT4/MT5, go to File → Login to Trade Account.
- Select your broker's server from the dropdown (if not listed, click "Scan" or add it manually).
- Enter your account number and password.
- Check the box "Enable AutoTrading" at the bottom of the login dialog.
- Click Login.
Wait for the connection icon (bottom-right corner) to turn green. If it stays red, check the server name — many brokers have separate "Live" and "Demo" servers.
Step 4: Install Your EA and Custom Files
Copy your EA files (the .ex4 or .ex5) into the appropriate folder. Do not drag-and-drop onto a chart yet.
- In the VPS, open MT4/MT5 and go to File → Open Data Folder (or press Ctrl+Shift+D in MT5).
- A Windows Explorer window opens. Navigate to
MQL4/Experts(MT4) orMQL5/Experts(MT5). - Paste your EA file(s) here. If your EA uses custom indicators, paste them into the
Indicatorssubfolder. If it needs DLLs, place them in theLibrariesfolder. - Restart MetaTrader (close and reopen). Now when you go to the Navigator panel (Ctrl+N) and expand "Expert Advisors," your EA should appear.
Step 5: Enable AutoTrading and Attach the EA
This is the most common point of failure. You must enable AutoTrading at three levels:
- Global platform setting: In MT4, click Tools → Options → Expert Advisors tab. Check "Allow Automated Trading" and uncheck "Disable automated trading when the platform is started" (critical for VPS). In MT5, go to Tools → Options → Expert Advisors and check "Allow Algorithmic Trading."
- Chart-level: Drag the EA from the Navigator onto a chart. A dialog appears. On the Common tab, check "Allow Live Trading," "Allow DLL imports" (if your EA uses DLLs), and "Allow import of external experts."
- Account-level: In the Terminal (bottom panel), click the Journal tab. After attaching the EA, you should see a line like "Expert 'YourEA' started successfully." If you see "AutoTrading disabled," go back to step 1.
Step 6: Configure Windows for Unattended Operation
Your VPS must not go to sleep or update automatically. Do the following:
- Open Control Panel → Power Options. Set "Turn off the display" to "Never" and "Put the computer to sleep" to "Never."
- Open Settings → Update & Security → Windows Update. Set active hours to cover 24 hours (e.g., 00:00-23:59) to prevent automatic restarts. Alternatively, set updates to "Notify to schedule restart" — but on Windows Server, you can disable updates entirely via Group Policy.
- Disable any screensaver: right-click desktop → Personalize → Lock screen → Screen timeout settings → set to "Never."
Step 7: Test and Monitor
Disconnect from the VPS (close the RDP window — do not log off). Wait 10 minutes, then reconnect. Your MetaTrader terminal should still be open and connected. Check the Journal tab: it should show a continuous connection. If it disconnected, the EA will still run — but if the terminal closed, that is a problem.
For ongoing monitoring, consider setting up push notifications (Tools → Options → Notifications) or using a third-party uptime monitor like UptimeRobot that pings your VPS IP.
Tips and Best Practices from Experience
- Use a separate VPS user account for trading. Do not run everything under Administrator. Create a standard user, give it full control over the MetaTrader folders, and log in as that user. This reduces attack surface.
- Never share your VPS with other people's EAs unless you fully trust them. A misbehaving EA can consume CPU and cause slippage for all terminals.
- Set up a scheduled task to restart MetaTrader daily at a low-volume time (e.g., 03:00 server time). Some EAs leak memory over weeks. A daily restart keeps the terminal fresh. Use a simple batch file:
taskkill /f /im terminal.exethenstart "" "C:\Program Files\YourBroker\terminal.exe". - Monitor disk space. MT4 log files can grow large. Set the log level to "Errors only" in Tools → Options → Expert Advisors, or delete logs weekly via a script.
- Enable two-factor authentication on your broker account and VPS login. Your VPS is a target — protect it.
Common Mistakes and Troubleshooting
Mistake 1: EA Not Running After VPS Reboot
Symptom: You restart the VPS (e.g., after a Windows update), and the EA does not start automatically.
Fix: MetaTrader does not automatically reattach EAs after restart. You must either:
- Save a chart template with the EA attached, then set MT4/MT5 to open that template on startup (File → Open Data Folder → config → move the template to the top of the list).
- Or use the AutoStartEA script (search MQL4 community) that reattaches EAs from a list.
- Or simply log in via RDP after each reboot and reattach manually — but that defeats the purpose of a VPS.
Better solution: Use the MetaTrader Web API or a third-party tool like EA Auto Attacher that runs as a Windows service.
Mistake 2: "No Connection" Despite Green Icon
Symptom: The connection icon is green, but the EA shows "No connection" in the Journal.
Fix: The green icon only means the terminal is connected to the broker's price feed. The EA's "No connection" usually means the EA itself cannot reach an external resource (e.g., a web API, a database, or a second broker). Check your EA's external dependencies. Also ensure the VPS firewall allows outbound connections on port 443 (HTTPS) and any custom ports the EA uses.
Mistake 3: EA Runs But Does Not Trade
Symptom: EA is attached, AutoTrading is enabled, but no trades appear.
Fix: Check the Experts tab in the Terminal (bottom panel) for error messages. Common causes:
- The EA's trading conditions are not met on the current timeframe/symbol.
- Your account is a "hedged" account but the EA uses netting (MT5) or vice versa.
- The EA has a minimum deposit requirement higher than your balance.
- The EA uses a DLL that is missing or blocked. Re-check the "Allow DLL imports" checkbox on the EA's Common tab.
Mistake 4: Terminal Freezes or Crashes After Days
Symptom: After 3-5 days, the terminal becomes unresponsive or crashes.
Fix: This is usually a memory leak in the EA or custom indicators. Set up the daily restart mentioned in the Tips section. Also, reduce the number of charts open — each chart consumes memory. One chart per EA is sufficient.
Summary and Next Steps
You now have a fully functional MetaTrader VPS setup: you chose a suitable provider, installed MT4/MT5 remotely, attached your EA with AutoTrading enabled at all levels, and hardened the Windows environment for 24/7 operation. Your EAs will now run continuously, independent of your local computer's uptime.
Next steps:
- Set up push notifications (Tools → Options → Notifications) to receive trade alerts on your phone.
- Enable email reporting from your EA so you get daily equity summaries.
- Consider a backup VPS in a different datacenter if your trading volume is high enough to justify the cost.
- Review your EA's performance weekly via the Account History tab — the VPS lets you backtest with live data, but you still need to monitor drawdown.
With your VPS running smoothly, you can focus on strategy development and






