Fix MT4 or MT5 Disconnects on VPS: Sleep Settings, Keepalive, and Uptime
Running Expert Advisors (EAs) on MetaTrader 4 or 5 requires a stable, 24/7 connection to your broker’s servers. However, default Windows Server power configurations, network timeouts, and sleep states can interrupt your trading sessions and cause missed trades. This guide will show you how to fix MT4 Disconnects on VPS by optimizing your power settings, adjusting TCP keepalive intervals, and automating terminal uptime.
Applying these essential adjustments to your low-latency Forex VPS will guarantee your trading platforms remain connected and operational 24/7 without sudden drops.
Note: Even with perfect Windows settings, your trading will suffer if your server lacks resources. Check out our guide on the Best VPS Specs for Forex EAs to ensure your hardware isn’t the bottleneck.
Table of Contents
Steps To Fix MT4 Disconnects on VPS
To effectively Fix MT4 Disconnects on VPS or MT5, you must configure Windows power plans, disable network power management, and optimize TCP keepalive settings. To do this, follow the steps below.
If you still don’t have a reliable trading server, you can use a low-latency Forex VPS from PerLod Hosting, which is already optimized for MT4 or MT5 and Expert Advisors.
Optimize Windows Power Settings to Stop Forex Disconnects
Windows Server default power plans can temporarily suspend system resources, which will immediately interrupt your trading platform’s connection. Setting the power plan to High Performance and disabling standby prevents the system from pausing disk or CPU operations.
To do this, run Command Prompt as an administrator and use the following powercfg commands.
Activate the High Performance power plan directly with the command below:
powercfg -setactive 8c5e7fda-e8bf-4a96-9a85-a6e23a8c635c
Disable the standby mode with the command below:
powercfg /change standby-timeout-ac 0
Stop the hard drive from powering down after a period of inactivity with the following command:
powercfg /change disk-timeout-ac 0
Completely disable hibernation with the following command, which frees up disk space and ensures the server never enters a deep sleep state:
powercfg /hibernate off
Disable Network Adapter Sleep for Continuous Trading
Windows has a default power-saving feature that can shut down your network connection and instantly drop your trading platform offline. To fix MT4 disconnects on VPS, you can disable this feature, which ensures continuous and unrestricted network activity for your trading data.
Run PowerShell as an administrator and run the command below:
Disable-NetAdapterPowerManagement -Name "*" -Confirm:$false
This command automatically finds all active network interfaces on the server and completely disables their power management features without pausing to ask for manual confirmation.
Tip: If you copy trades across multiple accounts, a stable connection is even more important. See how to Run Copy Trading on a VPS without missing trades.
Adjust TCP Keepalive to Prevent MT4 or MT5 Disconnects
If your MT4 or MT5 is idle during quiet market hours, the internet connection to your broker might automatically drop. By default, the Windows operating system waits a full 2 hours before sending a keepalive packet to verify an idle connection is still active.
To keep your trading session alive, the server needs to check the connection more frequently. You can run the PowerShell as administrator and change the Keepalive time to 5 minutes:
New-ItemProperty -Path "HKLM:\System\CurrentControlSet\Services\TcpIp\Parameters" -Name "KeepAliveTime" -PropertyType DWORD -Value 300000 -Force
To apply the changes, you must perform a full reboot.
Maximize Forex VPS Uptime with Auto-Start Configurations
If your VPS restarts automatically due to scheduled Windows maintenance or unexpected failures, your trading terminals will not launch. You can set up an auto-start, which guarantees your Expert Advisors (EAs) resume trading immediately after the server powers back on.
To do this, press Win + R on your keyboard, type shell:startup, and press Enter to open the Windows Startup folder.
Then, copy and paste the desktop shortcuts of your MT4 or MT5 applications directly into this folder.
Run the netplwiz command to enable auto-login. This prevents the server from getting stuck on the lock screen so your Expert Advisors can start trading right after a reboot.
Tip: If you trade funded accounts, automatic startup can help prevent problems after a restart. Check this guide on Prop Firm VPS Setup for a safer setup.
That’s it, by applying these essential adjustments, you can easily fix MT4 disconnects on VPS, and also for MT5.
FAQs
Why do my MT4 and MT5 keep losing connection on my VPS?
This usually happens because Windows power-saving features put your network connection to sleep. Using High Performance power settings and adjusting TCP Keepalive will fix these common disconnects.
Why does my broker connection drop over the weekend or during quiet hours?
Routers often drop inactive connections to save resources. Lowering your TCP Keepalive to 5 minutes sends regular heartbeats to keep the broker session alive during quiet times.
What happens to my Forex Trading if my VPS restarts automatically?
MT4 or MT5 will not open by itself after a VPS reboot. You must enable Windows auto-login and put your trading app shortcuts in the Startup folder for EAs to resume trading.
Conclusion
To Fix MT4 Disconnects on VPS permanently, simply keep these power and network settings active. A properly optimized low-latency Forex VPS combined with these Windows Tips is all you need to keep your Expert Advisors trading 24/7 without interruptions.
We hope you enjoy this guide. Subscribe to our X and Facebook channels to get the latest updates and articles on Forex Trading.