Guide · Setup and infrastructure

How to choose a VPS for MT4 and MT5 EAs

An EA only trades while its terminal is running and connected. Here is how to pick a VPS that keeps it that way: where it should be, how big it needs to be, which type suits your EA, and how to know when something stops.

Based on our team’s research and live testing since 2018.

An Expert Advisor is just a program inside your MetaTrader terminal. If the computer sleeps, loses internet, or restarts for an update, the EA stops. Open trades are left without their trailing stop, and daily loss guards cannot act. A virtual private server (VPS) is a computer in a data centre that stays on and connected, so the terminal keeps running when your laptop is closed.

We do not recommend specific providers here. Plans and prices change too often. Instead, this guide covers what to look for, so you can judge any offer yourself.

Do I really need a VPS for my EA?

You need one if any of these is true:

  • The EA holds trades overnight or trades outside your working hours.
  • It manages open trades: trailing stops, break-even moves, partial closes.
  • It enforces a prop-firm daily loss or drawdown limit.
  • Your home internet or power is not reliable.

If you only run an EA for an hour while you watch it, a home PC is fine. For anything unattended, use a VPS.

Where should the VPS be located?

As close as possible to your broker’s trade server. Every order travels from the terminal to that server and back. A VPS in the same city or data centre as the server typically gets a much lower ping than a home connection in another country.

Your broker’s server name does not always say where it is. Ask the broker’s support for the server location; many will tell you, and some partner with VPS providers in the same data centre. After setting up, check the ping that the terminal shows in its status bar, at the bottom right.

How much latency matters depends on the strategy. For a scalper that opens and closes within minutes, a few tens of milliseconds can change the fill. For a swing EA on H4, it hardly matters. In that case pick reliability over the last millisecond.

How much CPU and RAM does an EA need?

Less than most people expect, but it grows with every terminal, chart and symbol. The table is a rough starting point, not a measurement. Your EA, the number of charts and the amount of history change the numbers.

Setup (approximate)vCPURAMDisk
1 to 2 terminals, a few charts each1 to 22 to 4 GBSSD, 40 GB+
3 to 5 terminals2 to 44 to 8 GBSSD, 60 GB+
6 to 10 terminals, or heavy multi-symbol EAs4+8 to 16 GBSSD, 100 GB+

After a week, open Task Manager and look at CPU and memory at a busy time, such as the London open. If memory is above about 80% or CPU stays high, move up a size. Reduce load first by closing charts the EA does not need and lowering “Max bars in chart” in the terminal options.

MQL5 virtual hosting or a Windows VPS?

MetaQuotes offers its own virtual hosting, rented from inside the terminal. You choose a server close to your broker, and the terminal migrates your charts and EAs to it. It is the simplest option, but it has limits that matter for some EAs:

MQL5 virtual hostingWindows VPS
SetupFrom inside the terminal, minutesRemote desktop, install the terminals yourself
DLL callsNot allowedAllowed (64-bit DLLs for MT5)
AccountsTied to one trading account per subscriptionAs many terminals as the server can run
What runsCharts with EAs and their indicators; scripts are not migratedAnything you install
Other softwareNonePython bots, copiers, monitoring tools
MaintenanceManaged for youUpdates and restarts are your job

If your EA calls a DLL, needs files that other programs write, or works together with a Python bot, you need a Windows VPS. If it is a single self-contained EA on one account, MQL5 hosting is often enough. Note that an EA using WebRequest() also needs its URLs added to the allowed list on the hosted terminal. The current limits are on the MetaTrader help pages; check them before you migrate.

What breaks EAs on a VPS?

Most VPS problems are not hardware. They are restarts and settings:

  • Windows updates. Automatic updates can restart the server at any time. Set update restarts to a weekend time when markets are closed, and check after major updates.
  • No auto-start. After a restart, the terminal does not open by itself. Set Windows to log in automatically and put a shortcut to each terminal in the Startup folder, or use a scheduled task.
  • Algo trading switched off. If the terminal starts with the Algo Trading button off, the EA loads but does not trade. Check it after every restart.
  • Lost state. If the EA keeps its daily loss counter or high-water mark only in memory, a restart resets it. EAs should save state to disk; see how to make an EA prop-firm compliant for the method.
  • Disk full. Logs and tick history grow. Check free space monthly.

How do I know when my EA has stopped?

You should not have to log in to find out. A small monitoring EA on its own chart can send a push notification to the MetaTrader app on your phone when the terminal loses its connection or algo trading is switched off:

Heartbeat.mq524 lines
1// Heartbeat.mq5: push a warning to your phone if trading stops2// Needs your MetaQuotes ID in Tools > Options > Notifications.3input int InpCheckSeconds = 60;4bool g_warned = false;5 6int OnInit()  { EventSetTimer(InpCheckSeconds); return INIT_SUCCEEDED; }7void OnDeinit(const int reason) { EventKillTimer(); }8 9void OnTimer()10{11   bool   connected = (bool)TerminalInfoInteger(TERMINAL_CONNECTED);12   bool   algoOn    = (bool)TerminalInfoInteger(TERMINAL_TRADE_ALLOWED);13   double pingMs    = TerminalInfoInteger(TERMINAL_PING_LAST) / 1000.0; // microseconds14 15   if((!connected || !algoOn) && !g_warned)16   {17      SendNotification("Account " + IntegerToString(AccountInfoInteger(ACCOUNT_LOGIN)) +18                       ": connected=" + (connected ? "yes" : "no") +19                       ", algo trading=" + (algoOn ? "on" : "off"));20      g_warned = true;                       // one message per problem, not one a minute21   }22   if(connected && algoOn) g_warned = false;23   Comment(StringFormat("Ping to trade server: %.1f ms", pingMs));24}

This only works while the terminal and the VPS are running. If the whole server goes down, nothing inside it can send a message. For that, use an outside check as well, for example the provider’s uptime alerts, or a service that expects a regular signal from your server and warns you when it stops.

VPS checklist

  1. Ask your broker where the trade server is, and choose a VPS location close to it.
  2. Size the VPS for your number of terminals, then check real usage after a week.
  3. Choose MQL5 hosting for one simple EA; a Windows VPS for DLLs, several accounts or Python.
  4. Schedule Windows update restarts for the weekend.
  5. Make terminals start automatically and check Algo Trading after every restart.
  6. Make sure the EA saves its state to disk.
  7. Set up a heartbeat inside the terminal and an uptime check outside it.

Our MT4/MT5 EA development includes restart recovery and state saving as standard. To check the risk side of your setup, the position size calculator shows the lots for your risk and stop distance.

General information about trading infrastructure, not financial advice. Specifications are approximate starting points; your EA, broker and provider determine the real requirements. Check the current MetaTrader virtual hosting terms before you rely on them.

Quick answers

Can I run an EA on my home computer instead?

You can, but power cuts, internet drops, sleep mode and Windows updates all stop the EA. A VPS removes most of these. For short tests at home it is fine.

Do I need a VPS for a prop-firm account?

If the EA must manage open trades or enforce a daily loss limit around the clock, yes. A guard that is offline cannot close positions.

Does a closer VPS make my strategy more profitable?

Not by itself. Lower latency reduces the delay between signal and order. It matters for short-term strategies and very little for strategies that hold trades for hours or days.

Can I run several brokers on one VPS?

On a Windows VPS, yes: install a separate terminal for each account. If the brokers’ servers are in different cities, the VPS can only be close to one of them.

Is Linux a good choice for MetaTrader?

MetaTrader is a Windows program. It can run on Linux through a compatibility layer, but a Windows VPS is the simpler, more common setup for EAs.

Written by
Rohit B., Vertex Algorithms

Co-founder and lead developer. Building MT4/MT5 Expert Advisors, Python trading bots and Pine Script since 2018, with trading analysis by co-founders Harshal K. and Bilal M. About the founders →

Want your EA set up to survive restarts?

I build EAs that save their state, recover after a VPS reboot and warn you when trading stops. Tell me your broker, your terminals and your EA, and I will tell you what it needs.

WhatsApp