MetaTrader 5 on a Windows VPS: Setup That Keeps Your EAs Trading 24/7

Install MetaTrader 5 on a Windows VPS, then set up the session, auto-logon and a watchdog task so your Expert Advisors keep running after you disconnect or the VPS reboots.

dns WindowsVPS Team calendar_today schedule5 min read
MetaTrader 5 on a Windows VPS: Setup That Keeps Your EAs Trading 24/7
tocOn this page 8 sections
  1. Why MetaTrader 5 needs special handling on a server
  2. Step 1: Install the terminal
  3. Step 2: Attach Expert Advisors and enable algo trading
  4. Step 3: Disconnect, don't sign out
  5. Step 4: Survive reboots with auto-logon
  6. Step 5: Add a watchdog for crashes
  7. Sizing and location
  8. FAQ

To run MetaTrader 5 on a Windows VPS, install the terminal from your broker over RDP, log in to your trading account, attach your Expert Advisors and turn on algorithmic trading. To keep the EAs running around the clock, close your RDP window instead of signing out, stop Windows from ending idle or disconnected sessions, and set up auto-logon plus a watchdog task so the terminal starts again by itself after a reboot or crash. The rest of this guide covers each step.

Why MetaTrader 5 needs special handling on a server

MetaTrader 5 is a desktop GUI application, not a Windows service. It only runs inside an interactive user session, so your EAs work only while that session exists. If you sign out, Windows closes the session and the terminal with it. If Windows Update restarts the server and nobody logs back in, the terminal never starts. Nearly every "my EA stopped trading" report on a VPS comes down to one of these two things, so most of this setup is about keeping a session alive and bringing it back automatically.

Step 1: Install the terminal

  1. Connect to the VPS over Remote Desktop with the account that will run the terminal. Use a dedicated local account so trading doesn't depend on your personal admin login.
  2. Download the MetaTrader 5 installer from your broker's website. Broker builds come with the broker's trade servers already listed.
  3. Install to a short path you control, such as C:\MT5\BrokerName, not the default Program Files folder. A separate folder per broker makes multiple terminals easy to manage.
  4. Start the terminal, log in to your trading account and check the connection status and ping in the bottom-right corner of the window.

For portable installs, start terminal64.exe with the /portable switch. The terminal then keeps its data, logs and MQL5 folder inside its own install directory, not under the user profile. That makes backups and migrations a simple folder copy.

Step 2: Attach Expert Advisors and enable algo trading

  1. Open File > Open Data Folder and copy your EA files (.ex5) into MQL5\Experts. Copy any custom indicators into MQL5\Indicators.
  2. Right-click Expert Advisors in the Navigator and choose Refresh, then drag each EA onto its chart.
  3. In Tools > Options > Expert Advisors, allow algorithmic trading. Allow DLL imports or WebRequest URLs only if your EA's vendor says it needs them.
  4. Turn on the Algo Trading button on the toolbar. Then check the Experts tab in the Toolbox for the EA's startup messages.

Save the layout with File > Profiles (or just close the terminal cleanly). On its next start, MT5 restores the charts and their attached EAs.

Step 3: Disconnect, don't sign out

When you're done, close the RDP window with the X. Don't use Start > Sign out. Closing the window only disconnects you, and the session and terminal keep running. Then make sure Windows doesn't end disconnected or idle sessions later. In gpedit.msc, go to Computer Configuration > Administrative Templates > Windows Components > Remote Desktop Services > Remote Desktop Session Host > Session Time Limits and set the disconnected-session and idle-session limits to Never. You can do the same from an elevated PowerShell prompt:

$p = 'HKLM:\SOFTWARE\Policies\Microsoft\Windows NT\Terminal Services'
New-Item -Path $p -Force | Out-Null
Set-ItemProperty -Path $p -Name MaxDisconnectionTime -Value 0 -Type DWord
Set-ItemProperty -Path $p -Name MaxIdleTime -Value 0 -Type DWord
gpupdate /force

Step 4: Survive reboots with auto-logon

Windows Update will eventually restart the server. For the terminal to come back without you, Windows has to sign the trading account in at boot. The cleanest way is Microsoft's Sysinternals Autologon tool, which stores the password encrypted instead of in plain text in the registry. This is a security trade-off, so give the account a strong unique password and lock down RDP access first. Our hardening checklist isn't on the list of linkable pages, so start with your firewall rules and account lockout policy instead.

Next, start the terminal at logon. You can use a shortcut in the account's Startup folder or a scheduled task triggered At log on. Our guide on launching apps automatically when users sign in walks through both methods. Also set the server's active hours or maintenance window so update restarts happen when your markets are closed, for example over the weekend.

Step 5: Add a watchdog for crashes

Terminals sometimes crash, and a crash leaves the session alive but nothing trading. A small PowerShell script on a schedule can restart the terminal:

# C:\Scripts\mt5-watchdog.ps1
$exe = 'C:\MT5\BrokerName\terminal64.exe'
$running = Get-Process terminal64 -ErrorAction SilentlyContinue |
  Where-Object { $_.Path -eq $exe }
if (-not $running) {
  Start-Process -FilePath $exe -ArgumentList '/portable'
}

Register it as a scheduled task that repeats every few minutes and is set to Run only when user is logged on. That setting puts the restarted terminal in the visible desktop session, not in a hidden background one where you can't see or manage it. If the VPS runs other workloads, see setting scheduled task priority so the watchdog and terminal get CPU time first.

Sizing and location

Each MT5 terminal uses only modest resources. Memory use grows with the number of open charts, the symbols in Market Watch and heavy indicators, so trim anything you don't need. Latency to your broker's trade server usually matters more than raw CPU. Pick a VPS location close to the broker's servers and compare the ping shown in the terminal. For plan options built for this workload, see our Windows VPS for forex trading page.

FAQ

Will my EA stop if I close Remote Desktop?

No, as long as you close the window to disconnect instead of signing out, and the session time limits aren't set to end disconnected sessions.

Can I run several MetaTrader 5 terminals on one VPS?

Yes. Install each one into its own folder, run them in portable mode, and point the watchdog script at each executable's full path.

Can MetaTrader 5 run as a Windows service?

It isn't designed to. It needs an interactive desktop session, which is why auto-logon plus a logon task is the reliable approach.

}

Run this on your own Windows VPS

Get a Windows VPS from WindowsVPS in about 60 seconds, with full Administrator access over RDP, NVMe storage and the Windows license included.

Buy a Windows VPS →

dns

Written by the WindowsVPS Team

We run Windows Server VPS hosting and write these guides from the same setups our customers use: RDP, PowerShell, trading terminals and always-on bots. Questions about a guide? Contact us.

About WindowsVPS Windows VPS guides All articles

Ready to deploy your server?

Windows or Linux VPS — up and running in under 60 seconds.