Set up MetaTrader 4 or 5 on a Forex VPS
Run MetaTrader around the clock on a HyperDC Windows VPS: one terminal per account, log in, allow automated trading and keep terminals running after restarts.
- Beginner
- 25 min read
- Updated
On this page
A Forex VPS is a HyperDC Windows VPS that keeps MetaTrader 4 or 5 running around the clock, independent of your own computer, power and internet connection. This guide sets up the server, installs the terminals and makes sure your Expert Advisors keep working, also after updates and restarts.
Before you start
- A Windows VPS in the location closest to your broker's trading server; see the Forex VPS page for sizes and locations.
- Your trade account details from your broker: login number, password and server name.
- The Administrator details from the welcome email.
Step 1: Connect and secure the server
Connect with Remote Desktop, change the Administrator password and install updates: first steps on a Windows server. Limit Remote Desktop to your own IP addresses where you can, and consider changing the Remote Desktop port.
Step 2: Install the terminals
- Download MetaTrader 4 or 5 from your broker's website, or from the MetaQuotes websites
metatrader4.comandmetatrader5.com. - Run the installer. For the first terminal you can keep the default folder.
- For each additional terminal, run the installer again and choose Settings on the first screen to give it its own new folder, for example
C:\MT5\BrokerA-LiveandC:\MT5\BrokerB-Demo. Two copies cannot run from the same folder. - Rename the desktop shortcuts so you can tell the terminals apart.
Step 3: Log in to your trade account
In each terminal, open File › Login to Trade Account and enter your Login, Password and Server. Turn on Save password so the terminal reconnects automatically when it starts.
Verify: the connection indicator in the bottom-right corner of the status bar shows a connection to the trade server and the ping, and the Navigator lists your account.
Step 4: Allow automated trading
- Open Tools › Options › Expert Advisors and allow automated trading for the terminal (the option is called Allow Auto Trading or Allow algorithmic trading depending on the version).
- Leave Allow DLL imports off, unless an Expert Advisor you trust needs it.
- Turn on the Algo Trading button in the toolbar (called AutoTrading in older versions); it is green when automated trading is on.
- Drag your Expert Advisor from the Navigator onto a chart and allow trading in its settings.
Verify: the Expert Advisor's name appears in the top-right corner of the chart, and the Experts tab in the Toolbox shows that it was loaded.
Step 5: Keep the terminals running
- Disconnect, do not sign out. Close the Remote Desktop window when you are done; see Remote Desktop users and sessions.
- Control Windows Update. Set updates to Download only in SConfig and install them in a quiet market hour with a restart you plan; see fix Windows Update problems.
- Start the terminals after a restart. Put shortcuts of your terminals in the Startup folder (press
Win+Rand openshell:startup), and let Windows sign in automatically with Microsoft's Sysinternals Autologon tool. Autologon stores the password encrypted, but anyone who can restart the server gets the session, so keep the server's Remote Desktop access tight. Test it once with a planned restart and check that the terminals are running when you reconnect. - Take a snapshot before Windows updates or a new Expert Advisor; Windows VPS plans include free snapshots.
Step 6: Keep memory use in check
Every terminal, chart and Expert Advisor uses memory. Close charts you do not need, and lower Tools › Options › Charts › Max. bars in chart (minimum 5000) if a terminal uses a lot; restart the terminal after changing it. Backtesting in MetaTrader 5 uses every processor core of the server, so run large optimisations outside trading hours or on a larger plan.
Troubleshooting
Connection errors, Expert Advisors that do not trade and terminals that close: see MetaTrader on a VPS: troubleshooting.
Next steps
- Fix common problems: MetaTrader on a VPS: troubleshooting.
- More users on the server: Remote Desktop users and sessions.
Frequently asked questions
Which location should I choose?
The one closest to your broker's trading server, because your orders travel over that connection. Ask your broker where its servers are, and compare the ping MetaTrader shows in its status bar.
Can I run several accounts or brokers on one VPS?
Yes. Install one terminal per account or broker, each in its own folder, because two copies cannot run from the same folder. Plan memory for every terminal and the charts it keeps open.
Do my Expert Advisors keep running when I close Remote Desktop?
Yes, if you disconnect. Closing the Remote Desktop window keeps your Windows session and the terminals running; signing out closes them.
Do you give trading advice or recommend brokers?
No. We provide and support the server only. We do not give trading or investment advice, do not recommend brokers and have no arrangements with any of them.