Back to blog

How to Keep MT4 Running 24/7 on a VPS, with Auto-Start After Restart

IM Host EditorialOctober 10, 20269 min read
How to Keep MT4 Running 24/7 on a VPS, with Auto-Start After Restart

To keep MT4 or MT5 running 24/7 on a VPS you need four habits: disconnect from Remote Desktop instead of signing out, make the terminal start by itself when Windows logs in, decide when Windows Update is allowed to restart the server, and get an alert when the terminal or EA stops. This checklist covers each step for both platforms. One reminder first: a VPS keeps software running; it does not make an EA profitable, and trading carries a real risk of losing money.

Why terminals stop on a VPS

  • Signing out instead of disconnecting. The most common cause by far.

  • Windows Update restarts. Left on automatic, Windows installs updates and reboots when it decides to.

  • Server restarts after maintenance or a crash. If nobody logs in afterwards, nothing starts.

  • Terminal crashes from memory pressure or a faulty indicator.

  • Broker-side disconnects: the terminal is open but shows "No connection" or "Invalid account".

Step 1: Disconnect, never sign out

Closing the Remote Desktop window with the X button disconnects you and leaves every program running on the server. Choosing Sign out from the Start menu closes all programs, including MT4. Make closing the window your only way out. If you are new to Remote Desktop, the guide on connecting to RDP from Windows, Mac, Android and iPhone shows where these options are on each device.

Step 2: Make the terminal start automatically

Prepare the terminal itself

  • When you log in to the trading account, tick Save account information (MT4) or Save password (MT5) so the terminal reconnects after a restart.

  • Enable automated trading in Tools > Options > Expert Advisors: "Allow automated trading" in MT4, "Allow algorithmic trading" in MT5.

  • Attach your EAs to their charts. The terminal saves the open charts, EAs and inputs in the current profile when it closes normally.

Option A: Startup folder

Press Win + R, type shell:startup and press Enter. Create a shortcut there to terminal.exe (MT4) or terminal64.exe (MT5). Anything in this folder starts when your user logs on.

Option B: Task Scheduler (better for several terminals)

  1. Open Task Scheduler and choose Create Task.

  2. General tab: select Run only when user is logged on. The other option runs the terminal in a hidden background session that you cannot see or manage over RDP.

  3. Triggers tab: At log on for your user, and set Delay task for 30 seconds so the network is up first. Use 30, 60 and 90 seconds for three terminals to stagger them.

  4. Actions tab: Start a program, pointing to the terminal's .exe, with /portable in the arguments if you use it (see Step 4).

The logon problem

Both options need a logged-on user. After a reboot, Windows waits at the sign-in screen and nothing starts until someone logs in. You have two choices:

  • Log in manually after every reboot. Safest. Combine it with the monitoring in Step 6 so you know when a reboot happened.

  • Enable automatic logon. Microsoft's Sysinternals Autologon tool stores the password encrypted. Avoid the old registry method that writes the password in plain text under Winlogon\DefaultPassword. Autologon only makes sense on a server used for trading alone, with a long unique password.

Whichever you choose, test it: restart the server on purpose, wait two minutes, connect, and confirm every terminal is running, connected, and shows the AutoTrading (MT4) or Algo Trading (MT5) button active.

Step 3: Control Windows Update restarts

Do not turn updates off. They patch Remote Desktop and other services that attackers scan for constantly. Control the timing instead:

  • sconfig: run sconfig in an administrator console and set the update setting to Download only or Manual.

  • Group Policy: in gpedit.msc go to Computer Configuration > Administrative Templates > Windows Components > Windows Update, set Configure Automatic Updates to "Auto download and notify for install", and enable No auto-restart with logged on users for scheduled automatic updates installations.

  • Weekend routine: the FX market closes on Friday evening New York time and reopens on Sunday evening. Install updates on Saturday, reboot, and check every terminal before the open.

Active hours alone do not solve it: they cover at most 18 hours, and the market runs around the clock on weekdays.

Step 4: Run several terminals cleanly

  • One install folder per terminal. In the installer, click Settings and choose a folder such as C:\Trading\MT4-BrokerA-1. A second account gets C:\Trading\MT4-BrokerA-2.

  • Use portable mode. Started with /portable, the terminal keeps its data (MQL folder, profiles, logs, config) inside its own install folder instead of a hidden folder under AppData. Backups and moves become simple.

"C:\Trading\MT4-BrokerA-1\terminal.exe" /portable
"C:\Trading\MT5-BrokerB\terminal64.exe" /portable

Always start a portable terminal with the flag; without it, the terminal looks for its data elsewhere and opens with empty charts.

Step 5: Keep each terminal light

As a rule of thumb, a lightly loaded MT4 terminal uses a few hundred MB of RAM, while MT5 with many symbols or heavy indicators can pass 1 GB. Windows Server itself wants around 2 GB. Check Task Manager after a full trading day and keep at least 20 to 30% of RAM free. To cut the load:

  • Max bars in chart: in Tools > Options > Charts, lower it (MT4 also has "Max bars in history") unless your EA needs deep history. Check the EA's documentation first.

  • Close unused charts. Every chart with indicators recalculates on each tick.

  • Trim Market Watch: right-click, Hide All, then show only the symbols you trade.

  • Disable news in Tools > Options > Server, and turn off event sounds.

  • Do not optimize in Strategy Tester on the live server. It can use every CPU core for hours.

Step 6: Monitor the terminal and the EA

  • Push notifications: install the MT4 or MT5 app on your phone and copy its MetaQuotes ID. On the VPS, open Tools > Options > Notifications, enable push notifications, paste the ID and press Test. EAs that call SendNotification() can then alert you on trades and errors.

  • Journal and Experts tabs: look for lost connections, "expert removed", "trade context busy" and "off quotes". Repeated errors mean something needs attention.

  • A watchdog for crashes: a short PowerShell script restarts the terminal if it is no longer running.

$exe = "C:\Trading\MT4-BrokerA-1\terminal.exe"
$running = Get-Process -Name terminal -ErrorAction SilentlyContinue | Where-Object { $_.Path -eq $exe }
if (-not $running) { Start-Process -FilePath $exe -ArgumentList "/portable" }

Save it as C:\Scripts\mt4-watchdog.ps1 (use terminal64 for MT5). In Task Scheduler, create a task with trigger "At log on", tick "Repeat task every 5 minutes" for "Indefinitely", run only when the user is logged on, and use the action powershell.exe with the arguments -NoProfile -ExecutionPolicy Bypass -WindowStyle Hidden -File C:\Scripts\mt4-watchdog.ps1. Disable the task before you close a terminal on purpose, or it will reopen within five minutes.

When the terminal disconnects

  1. Read the status bar and the Journal tab. "No connection" points to the network or broker; "Invalid account" points to login details.

  2. Click the connection indicator and choose Rescan servers.

  3. Check the server's own internet by opening any website in its browser.

  4. Check your broker's announcements. After a server migration you may need the new server name, which you can find through File > Open an Account by searching the broker's name.

  5. For "Invalid account", confirm the password has not been changed or the account archived.

  6. Restart the terminal. If the whole server is unreachable, contact your hosting support.

If disconnections happen often and the ping is high, the server may simply be far from the broker. Our guide on choosing a forex VPS location by your broker's server explains how to check.

Back up profiles, EAs and settings

Use File > Open Data Folder to see what matters: the MQL4 or MQL5 folder (Experts, Indicators, Include, Libraries, Presets), plus profiles and templates. With the terminal closed, for example during the weekend update window, zip them (create C:\Backups first):

Compress-Archive -Path "C:\Trading\MT4-BrokerA-1\MQL4", "C:\Trading\MT4-BrokerA-1\profiles", "C:\Trading\MT4-BrokerA-1\templates" -DestinationPath "C:\Backups\mt4-a1-$(Get-Date -Format yyyy-MM-dd).zip"

Copy the zip off the server too. Server-level backups protect the whole machine; your own archive lets you roll back one bad .set file.

Security basics that protect uptime

  • Use a long, unique password for the Administrator account and never send it to a signal provider or EA developer.

  • If someone needs access, create a separate standard user. For account monitoring, share the investor (read-only) password, not the master password.

  • Restrict Remote Desktop exposure and lock out repeated failed logins, as covered in securing your Windows VPS and RDP.

Choosing the right server

The IM HOST Forex VPS plans are sized by terminal count: Lite for 1 terminal, Standard for up to 2, Pro for up to 5 and Elite with no terminal limit, all with dedicated vCPU, NVMe, free daily backups and full Administrator RDP access. If the same server will also run office software or other Windows tools, a general Windows VPS with RDP from 4 GB up to 256 GB RAM may fit better. For first-time installation, see the complete forex VPS guide for MT4 and MT5.

Frequently asked questions

Does MT4 keep running if I close Remote Desktop?

Yes, if you close the window, which only disconnects the session. No, if you choose Sign out, which closes every program.

How do I make MT4 start automatically after the VPS restarts?

Put a shortcut in the Startup folder or create an "At log on" task in Task Scheduler. Both need a logged-on user, so either log in after each reboot or set up automatic logon carefully.

How many MT4 terminals can one VPS run?

It depends on charts, symbols and EAs more than on terminal count. Measure after a full day and keep 20 to 30% headroom.

Will Windows Update restart my VPS during trading?

It can if updates are fully automatic. Set them to download only, then install and reboot on Saturday when the FX market is closed.

If you want a server built for this, the IM HOST Forex VPS comes with Windows Server installed automatically and plans from $14.99/mo. Our engineers are available 24/7 if a terminal or the server itself will not come back after a restart.

More from our blog

Discover more practical guides and product insights from the IM Host team.

View all articles