VPS Hosting for Forex: Run MT4/MT5 on a Windows VPS 24/7
- October 21, 2026
- 9:00 am
- By Adrien Roche
- Tutorials

What VPS hosting for forex actually gives you
VPS hosting for forex is nothing exotic: a Windows virtual server in a datacenter that you reach over Remote Desktop. It never sleeps, it sits on a datacenter link with a stable route to your broker, and it keeps working when you close the lid. MetaTrader runs on the VPS; your laptop becomes a remote control.
MetaQuotes' Virtual Hosting, sold inside the terminal, suits one account but gives you a migrated copy, not a machine. A VPS you administer runs terminals from several brokers side by side and lets you keep the files. MT4 is 32-bit (terminal.exe); MT5 is 64-bit (terminal64.exe). Both run on Windows Server 2019/2022 and Windows 10/11 Pro as they are.
Install MetaTrader 4/5 and log in to your broker
1. Connect and fetch the installer
Open the VPS with the client built into Windows: Win + R, mstsc, the server's IP, the Administrator password. Save an .rdp file and redirect a local drive; it is the simplest way to move installers in and backups out. The Windows Remote Desktop Connection (mstsc) guide covers every option tab. Download the terminal from your broker's site; MetaQuotes no longer distributes a generic MT4 installer.
2. Pick the install folder deliberately
The installer proposes C:\Program Files\<Broker> MetaTrader 5 (Program Files (x86) for MT4). If you might ever run a second terminal, give each its own folder, such as C:\Trading\BrokerA-MT5. By default the data, EAs included, lives in %APPDATA%\MetaQuotes\Terminal\<32-character id>\; the /portable switch keeps it inside the install folder instead, which makes copies and backups self-contained:
"C:\Trading\BrokerA-MT5\terminal64.exe" /portable
"C:\Trading\BrokerB-MT4\terminal.exe" /portablePut the switch in the shortcut's Target field and always use that shortcut; started once without it, the terminal creates a second, empty data folder.
3. Log in and let the terminal remember it
File > Login to Trade Account: account number, password, server. Tick Save account information (MT4) or Save password (MT5) so the terminal can reconnect by itself after a restart. Confirm in the Journal tab that the login was authorized.
Attach EAs and enable AutoTrading
File > Open Data Folder, then drop .ex4/.mq4 files into MQL4\Experts or .ex5/.mq5 into MQL5\Experts, indicators into Indicators. Right-click Expert Advisors in the Navigator and choose Refresh.
In Tools > Options > Expert Advisors, Allow automated trading (MT4) or Allow algorithmic trading (MT5) must be on. Enable Allow DLL imports only for an EA that needs it and whose author you trust; EAs that call external APIs need their URLs in the WebRequest list on the same tab.
Drag the EA onto a chart of the right symbol and timeframe, tick Allow live trading (MT4) or Allow Algo Trading (MT5) in the Common tab, set the Inputs. Then switch on the global AutoTrading button in the toolbar (Algo Trading in recent MT5 builds) or press Ctrl+E. Trading requires both the global button and the per-EA checkbox; forget either and you get a silent EA with a sad face or crossed icon in the chart corner. Check the Experts tab of the Toolbox for errors, and run on a demo account first.
Leave without stopping anything: disconnect, never sign out
An RDP session and a Windows logon are different things. Closing the Remote Desktop window with the X, or running tsdiscon, disconnects your screen but leaves the session running with every terminal in it. Sign out in the Start menu, or logoff, ends the session and closes MetaTrader. Reconnecting puts you back into the same session.
| What you do | Session | Your EAs |
|---|---|---|
Close the RDP window (X) or run tsdiscon | Kept, disconnected | Keep running |
Start menu > Sign out, or logoff | Ended | Stopped |
| Reboot without auto-login | Gone, nobody logs in | Dead until you log in |
| Reboot with auto-login + at-logon task | New console session | Back automatically |
Two things can undo this. A group policy that ends disconnected sessions lives in gpedit.msc under Computer Configuration > Administrative Templates > Windows Components > Remote Desktop Services > Remote Desktop Session Host > Session Time Limits: Set time limit for disconnected sessions must be Not Configured or Disabled (registry: MaxDisconnectionTime under HKLM\SOFTWARE\Policies\Microsoft\Windows NT\Terminal Services).
The other is networking on the VPS itself. Routing the server through a VPN takes the RDP connection down with it unless you do it as described in using a VPN on an RDP server without losing the connection. And when a reconnect hangs on "Connecting" and fails, the causes are in fixing a Remote Desktop connection timeout; the session and your EAs are usually fine on the server side.
Survive reboots: auto-login and a scheduled terminal restart
Windows Update, a provider maintenance window, or your own fix will reboot the VPS eventually, and after a reboot nobody is logged in, so nothing runs. Three pieces close that gap.
1. Log the account in automatically at boot
Use Sysinternals Autologon: run it, enter the account and password, click Enable; the password is stored as an encrypted LSA secret. The registry route (AutoAdminLogon, DefaultUserName, DefaultPassword under HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon) does the same but leaves the password in plain text. The console session now sits unlocked; a Startup-folder shortcut (shell:startup) to rundll32.exe user32.dll,LockWorkStation locks it right after logon without stopping anything.
2. Start the terminals at logon
Create C:\Trading\start-terminals.cmd with one start line per terminal, then register it as a task that fires at logon, with a minute's delay for the network:
@echo off
start "" "C:\Trading\BrokerA-MT5\terminal64.exe" /portable
start "" "C:\Trading\BrokerB-MT4\terminal.exe" /portable
schtasks /create /tn "Start MetaTrader" /tr "C:\Trading\start-terminals.cmd" /sc onlogon /delay 0001:00 /it /rl highestRun schtasks as the account that auto-logs in; without /ru the task runs in that user's interactive session, which a GUI application needs. With saved credentials and profile, the terminal logs in, reattaches the EAs with their inputs, and restores the AutoTrading state by itself.
3. Restart the terminals on a schedule
Terminals accumulate logs and the occasional stuck reconnect. A weekly restart while the market is closed (Saturday is safe worldwide) keeps them clean; taskkill without /F asks for a graceful close, which also saves the profile:
taskkill /IM terminal64.exe
timeout /t 30 /nobreak
taskkill /IM terminal64.exe /F 2>nul
call C:\Trading\start-terminals.cmd
schtasks /create /tn "Weekly MetaTrader restart" /tr "C:\Trading\restart-terminals.cmd" /sc weekly /d SAT /st 10:00 /it /rl highestAdd the same lines for terminal.exe if MT4 is in the mix. Finally, set Windows Update to download and notify (sconfig on Server, or the Configure Automatic Updates policy) and reboot on Saturday yourself; the chain above brings everything back.
Several terminals on one VPS, and how to size it
One terminal serves one account, so several accounts mean several terminals: each in its own folder, each started with /portable. Files an EA writes with the common flag land in %APPDATA%\MetaQuotes\Terminal\Common\Files, shared by all.
Resource use depends less on the number of terminals than on what each does: open charts, bars kept in memory (Tools > Options > Charts > Max bars in chart), indicators redrawing every tick, EAs busy during news, and the news feed, which Options > Server can switch off. MT5's strategy tester will take every core it finds, so never optimize on the machine that trades live. Measure after a full trading day:
Get-Process terminal, terminal64 -ErrorAction SilentlyContinue |
Select-Object Name, Id, @{n="RAM_MB";e={[int]($_.WorkingSet64/1MB)}}, CPUIf steady-state RAM sits above roughly three quarters of the plan, or CPU pegs at the London and New York opens, move up a tier before adding a terminal. Dedicated CPU and RAM matter: on oversold shared cores a neighbour's spike lands on your tick processing.
Measure latency to your broker and pick the region
Latency only matters for strategies that count milliseconds: scalping, news, arbitrage. An EA on H1 charts cares about uptime, not the round trip.
Ask the broker where its trade servers are hosted; many answer with an Equinix site such as NY4 in Secaucus, LD4 near London, or FR2 in Frankfurt. Then measure from the VPS. Click the connection indicator in the terminal's bottom-right corner to list the broker's access points with a ping for each (MT5 also shows it in the status bar; that is the round trip to the access point, not necessarily to the matching engine). Then find the address the terminal is connected to and ping and trace it; some brokers drop ICMP, so a TCP test on the usual port 443 is the fallback:
Get-NetTCPConnection -State Established -OwningProcess (Get-Process terminal64).Id |
Select-Object RemoteAddress, RemotePort
ping -n 20 203.0.113.45
tracert -d 203.0.113.45
Test-NetConnection -ComputerName 203.0.113.45 -Port 443Watch the spread between minimum and maximum, not only the average; a steady route beats a slightly faster jittery one. Then choose: US-hosted broker, New York VPS; London or Frankfurt, a European VPS. Accounts on both sides of the Atlantic: put the VPS next to the latency-sensitive one, or run one per region.
Back up the MQL folder, and the rest of the data folder
EAs, .set presets, and chart layouts take hours to rebuild and all live in the data folder: MQL4 or MQL5 (Experts, Indicators, Include, Libraries, Files, Presets), profiles and templates in MT4 or MQL5\Profiles in MT5, and config for terminal settings. Skip price history; the terminal downloads it again. A daily mirror plus a dated archive covers most disasters:
robocopy "C:\Trading\BrokerA-MT5\MQL5" "C:\Backups\BrokerA\MQL5" /MIR /R:1 /W:2 /NP
powershell -Command "Compress-Archive -Path C:\Backups\BrokerA -DestinationPath C:\Backups\BrokerA-$(Get-Date -Format yyyyMMdd).zip -Force"/MIR deletes files from the destination that no longer exist in the source: right for a mirror, wrong if you point it at the wrong folder. Add a second line for config, schedule the script with schtasks /sc daily, then get the archive off the VPS over the redirected drive or with a cloud sync client watching C:\Backups.
If you still need the server itself, a Forex VPS from rdp.monster in New York or Europe is delivered about 10 seconds after payment confirms, with full administrator access, dedicated CPU and RAM, unlimited (fair-use) bandwidth, no KYC, and crypto accepted at checkout, from $8.99/month. You pick the region at checkout; test latency to your broker first.
Frequently Asked Questions
Do I need a VPS to run MT4 or MT5 Expert Advisors?
Does closing the Remote Desktop window stop MetaTrader?
tsdiscon, leaves MetaTrader trading. What stops it is Sign out from the Start menu, the logoff command, or a reboot. The one exception is a group policy that ends disconnected sessions after a time limit; check Session Time Limits in gpedit.msc and make sure it is not configured. When you connect again you land back in the same session, with the same charts open.How many MetaTrader terminals can I run on one VPS?
/portable, then measure after a full trading day with Task Manager or Get-Process. If steady-state RAM approaches the plan's limit or CPU saturates at the London or New York open, upgrade before adding another terminal, not after the first missed trade.Which VPS location is best for forex trading?
ping plus tracert from the VPS confirm the route. Latency only matters for scalping and news strategies; for slower EAs, uptime and a stable connection count for more than a few milliseconds.Adrien Roche, Infrastructure & Hosting Editor
Systems engineer with 10+ years operating Windows Server and Linux fleets. Adrien runs the rdp.monster infrastructure documentation and writes our guides on RDP, VPS hosting, server administration, networking and privacy tooling.




