Summary: This tutorial explains how to set up a Virtual Private Server (VPS) for MetaTrader 4 and 5, including remote desktop connection, EA installation, auto-restart configuration, and an overview of MetaQuotes integrated hosting plans.




A few months ago, I had an EA that kept missing entries overnight because my laptop would go to sleep or the Wi-Fi would glitch. I tried leaving the computer on, disabled sleep mode, even bought a UPS for power outages. None of it worked reliably. That's when I finally caved and moved everything to a VPS.

What a VPS Actually Does

A VPS is basically a remote Windows computer sitting in a data center, running 24/7 with its own internet connection and power backup[citation:9][citation:11]. For a trader running EAs, this means your trading robots keep running even when you shut down your local machine, the power goes out, or your ISP decides to take a nap.

The Setup Process

Here's how I got mine running, step by step. The process is similar whether you're setting up MT4 or MT5 on a VPS[citation:1].

Step 1: Get a VPS and Log In

First, pick a provider. Some brokers offer sponsored VPS plans if you meet certain trading volume or balance requirements[citation:6][citation:7]. Others are third-party services like NewYorkCityServers or generic cloud providers. The key is to choose one physically close to your broker's servers to reduce latency[citation:10].

Once you've signed up, you'll receive login credentials: an IP address, username, and password. To access the VPS, open Remote Desktop Connection on your Windows machine (search for it in the Start menu), enter the IP address, and log in[citation:1][citation:2]. On Mac, use the Microsoft Remote Desktop app from the App Store[citation:6].

Step 2: Install MetaTrader on the VPS

Inside the VPS remote desktop, open a browser, go to your broker's website, and download the MetaTrader 4 or 5 installer. Run it and install the platform just like you would on your local computer[citation:1][citation:5].

A Gotcha I Ran Into

If you're running multiple accounts on the same VPS, the default installer will overwrite the first installation. To run two or more MT4 instances side by side, you need to change the installation folder for each one—for example, C:\Program Files (x86)\BrokerName MT4-2 for the second instance, and so on[citation:2]. Then create separate shortcuts on the VPS desktop for each terminal.exe.

Step 3: Install Your EA and Configure Settings

Copy your EA files (.ex4 and any associated .dll files) into the MQL4\Experts folder inside the MT4 installation directory on the VPS[citation:1]. If your EA uses DLLs, make sure you also copy them into MQL4\Libraries.

Launch MT4, log in to your trading account, attach the EA to a chart, and enable the following in the EA's properties:
  • Allow DLL imports

  • Allow automated trading


  • Also, make sure the "AutoTrading" button (the green play button at the top of the terminal) is activated.

    Step 4: Set Auto-Restart After Reboot

    VPS providers occasionally reboot servers for maintenance[citation:10]. If your MT4 doesn't restart automatically, your EA will stay offline until you manually log back in. To avoid this, place a shortcut to terminal.exe in the Windows Startup folder on the VPS[citation:1]. That way, whenever the VPS reboots, MT4 launches automatically.

    The MetaQuotes Integrated VPS Option

    There's also a built-in VPS service from MetaQuotes itself. Right-click your account in the Navigator window and select "Register a Virtual Server" (on MT5) or find it under the Tools menu in MT4[citation:3][citation:12]. The system automatically picks the server closest to your broker to minimize latency[citation:3]. This requires a valid MQL5.community account and a subscription plan, though some brokers offer sponsored plans that are free[citation:3][citation:12]. The big advantage is that it's fully integrated and transfers your charts, indicators, and EAs automatically. The downside is less control over the underlying hardware compared to a third-party VPS.

    A Tip on Latency

    Latency is more critical than you might think. If your VPS is 100 milliseconds away from your broker's server, that delay compounds across multiple communication loops in MT5—effectively making it 300ms of visible lag[citation:10]. For a scalper, that could mean missing entries entirely. I benchmark my VPS ping using the built-in trade server diagnostics in MT5 and aim for under 5ms[citation:10].

    Reference: MetaQuotes Help Center - Virtual Hosting (metatrader5.com), MQL5 Community News - VPS for Automated Trading (metaquotes.net).

    This article was originally published on FXEAR.com. All rights reserved. Unauthorized reproduction is prohibited.