GuideUpdated 26 November 20268 min read

Why MetaTrader does not come back after a Windows VPS reboot, and the full fix: automatic logon, a startup shortcut, EAs that resume and a test restart.

In short
  • After a reboot Windows waits at the sign-in screen, and programs in the Startup folder only run once a user signs in. Until then MetaTrader stays closed.
  • The fix is automatic logon (for example with Microsoft's Autologon tool) plus a shortcut to each terminal in the Startup folder (shell:startup).
  • For the EAs to trade again, save the account login, leave AutoTrading on and keep the EAs attached to the charts of the saved profile.
  • Test it: restart on purpose, wait a few minutes, reconnect and check the start time in the terminal's Journal tab.
  • On a Dipgate Trading VPS autologon is already set up: move the platform shortcut into the My Platforms Autostart folder.

MetaTrader does not come back after a Windows reboot because Windows starts up and then waits at the sign-in screen. Programs in a user's Startup folder only run once that user signs in, so until someone signs in, MetaTrader stays closed, and even then it opens only if a shortcut in the Startup folder tells Windows to start it. The fix has two parts, automatic logon and a startup shortcut for each terminal, plus a few MetaTrader settings so the Expert Advisors trade again once the terminal is back. Then you prove it works with a deliberate restart.

After a restart Windows signs in by itself, the Startup folder opens MetaTrader and the Expert Advisors resume
The chain that has to work without you after every restart.

Why the terminals do not come back

Find your symptom, then go to the step that fixes it.

What you see after a rebootCauseFix
Nothing is running, terminals open only when you start them by handNo automatic logon and no startup entrySteps 1 and 2
Terminals are open when you connect, but they were not running before you connectedStartup shortcut exists, but nobody was signed in until you connectedStep 1
Terminal is open but shows no connection or asks for a passwordAccount login not savedStep 3
Terminal is connected, EAs are on the charts, but nothing tradesAutoTrading was off, or an option disabled itStep 3
Charts or EAs are missingLast changes were not saved in the profile, or another profile openedStep 3
It worked, then stopped after you changed the VPS passwordAutomatic logon still holds the old passwordStep 1
Terminals close each time you leave the VPSYou sign out instead of disconnectingClose the Remote Desktop window instead of signing out

The last row is not a reboot problem, but it looks like one. Disconnecting (closing the Remote Desktop window) leaves your session and its programs running. Signing out ends the session and closes MetaTrader with it.

How to Autostart MetaTrader 4 or 5 After a VPS Reboot (Autologon + Startup Folder)
Video: How to Autostart MetaTrader 4 or 5 After a VPS Reboot (Autologon + Startup Folder)

Step 1: sign in automatically after a reboot

On a Dipgate Trading VPS this step is already done: autologin is set up on the VPS. Come back to it only if you change the VPS password, because the autologin then has to be set again.

On any other Windows VPS or PC, Microsoft's free Autologon tool from Sysinternals sets up Windows' own automatic logon:

  1. Connect to the VPS with Remote Desktop as the user who will run MetaTrader (on most VPS this is Administrator).
  2. Download Autologon from the Microsoft page above, unzip it and run it.
  3. Check the Username and Domain fields: Username must be the user who runs MetaTrader. Autologon fills both in for the user you are signed in as; on a Dipgate Trading VPS, use the Domain value that Dipgate's knowledge-base article (linked below) gives.
  4. Type the password of that user, carefully. Autologon does not check it: a typo only shows up at the next boot, when the sign-in silently fails.
  5. Click Enable and confirm.

Three things to know about it, from Microsoft's page:

  • The password is stored encrypted in the registry, but a user with administrator rights can retrieve it. So use a password you do not use anywhere else.
  • Holding Shift while Windows boots skips the automatic logon once.
  • Disable in the same tool turns it off. The command-line form is autologon user domain password.

Step 2: put a shortcut where Windows starts it

On a Dipgate Trading VPS: move the platform shortcut into the My Platforms Autostart folder on the VPS. One shortcut per terminal.

On any Windows machine, the standard place is the Startup folder (Microsoft support):

  1. Right-click the Start button and choose Run (or press the Windows key and R).
  2. Type shell:startup and press Enter. This opens the Startup folder of the user you are signed in as. shell:common startup opens the shared one, used for any user who signs in.
  3. Copy the desktop shortcut of each terminal into that folder. Keep the renamed shortcuts, and keep /portable in the target if you use portable mode.
  4. Put each shortcut in one Startup folder only, not in both.

If you run several terminals, you can start them one after another instead of all at once, so they do not all load their history at the same moment. Save this as start-terminals.bat (paths are examples), and put a shortcut to it in the Startup folder in place of the single terminal shortcuts:

@echo off
start "" "C:\MT4\Broker-1234567\terminal.exe"
timeout /t 20 /nobreak
start "" "C:\MT4\Broker-1234568\terminal.exe"
timeout /t 20 /nobreak
start "" "C:\MT5\Broker-7654321\terminal64.exe" /portable

timeout /t 20 /nobreak waits 20 seconds before the next line (timeout reference). The 20 is an example: shorten or lengthen it to taste. Use either the batch file or the individual shortcuts, not both. To set up several terminals in the first place, see running multiple MT4 terminals with the same broker.

Step 3: make sure the EAs trade when the terminal comes back

A terminal that opens is not yet a terminal that trades. Check these in each copy, before the test restart:

CheckWhereWhy it matters
Account login savedFile, Login to Trade Account, with the option to save the account information tickedWithout it the terminal opens disconnected and waits for a password
AutoTrading onAutoTrading button on the toolbarThe button normally keeps the state it had when the terminal closed; if it was off, the EAs stay idle
Automated trading allowedTools, Options, Expert AdvisorsThe global switch must be on. The same tab has options that disable automated trading when the account, the profile or a chart's symbol or period changes: if EAs keep coming back disabled, look here first
DLL imports, only if your EA needs themSame tabAn EA that calls a DLL cannot work with this option off
EAs attached to the right chartsEach chart, top-right corner: the EA name and its status iconThe terminal reopens the charts of the current profile, with the EAs attached to them
Profile savedFile, Profiles, save the profile under a clear nameChart changes are saved in the current profile automatically, but a named copy lets you reload the setup if something goes wrong

After the setup, close each terminal once with File, Exit and start it again from its shortcut. You will see straight away whether the charts, the EAs and the AutoTrading state come back as you left them. A real crash or a forced restart does not give MetaTrader the chance to close cleanly, which is one more reason to have the profile saved beforehand.

One check sits outside MetaTrader: the EA's own memory. The open trades are on the broker's server and come back with the connection, and the EA's input settings are stored with the chart. What the EA does with its internal state after a restart (a grid level, a counter, a daily limit) depends on how it was written. Ask the vendor, or read its manual, before you rely on it through a reboot.

Step 4: test it with a deliberate restart

Pick a quiet moment, for example the weekend, when the market is closed or your EAs have no open trades.

  1. Write down what should be running: which terminals, which accounts, which EAs on which charts.
  2. Restart the VPS: Start menu, Power, Restart, or type shutdown /r /t 0 in a Command Prompt (shutdown reference).
  3. Wait a few minutes before you reconnect. Your own Remote Desktop sign-in can also launch the Startup folder, so connecting too early can hide a missing automatic logon.
  4. Connect again. In each terminal open the Journal tab at the bottom: the first lines show when the terminal started. If that time is minutes before you connected, automatic logon works. If it matches the moment you connected, go back to Step 1.
  5. Check the rest against your list: connection indicator in the bottom-right corner active, AutoTrading on, each EA on its chart with its status icon, no errors in the Experts tab.
  6. Leave by closing the Remote Desktop window, not by signing out.

If you want to check the hard case too, shutdown /r /f /t 0 forces programs to close without waiting. Microsoft warns that forcing can lose unsaved data, so do it only after the profile is saved.

When this is not the right fix

  • The terminal crashes while Windows keeps running. Startup entries only act at sign-in. A terminal that dies in the middle of the week stays closed until someone restarts it. Find the cause instead: see why a trading VPS gets slow and MT4 keeps disconnecting on a VPS.
  • The VPS reboots often without you asking. Autostart makes each reboot cheaper, but frequent restarts have a cause to find. In Windows Event Viewer, the System log records them: event 1074 is written when an app (Windows Update, for example) or a user starts a restart, event 6008 when the previous shutdown was unexpected (Rackspace guide). On a Dipgate VPS, open a support ticket with those times. If the VPS freezes rather than restarts, Dipgate's article on resolving issues with a stuck VPS lists the usual causes: heavy load, full memory, CPU, RAM or disk overload.
  • Platforms other than MetaTrader. The Startup folder works the same for NinjaTrader or TradeStation, but reconnecting and re-enabling strategies are settings of that platform. Check its own documentation.
  • You do not want to manage Windows at all. For a single MetaTrader account, Metatrader In Cloud gives you one MetaTrader in the browser, with no operating system for you to set up (see below).

How this works on Dipgate

On a Trading VPS (Windows Server 2022, 2019 or 2016), autologin is set up on the VPS for you. To autostart a platform after a reboot, move its shortcut into the My Platforms Autostart folder. If you change the VPS password, redo the autologin with Autologon and the Startup folder, as Steps 1 and 2 describe. Dipgate's knowledge-base article How to Autostart Metatrader 4/5 after a VPS reboot and its video show the same procedure. Dipgate's resource-monitoring article also suggests a weekend reboot, which is a good moment for the test in Step 4.

On Metatrader In Cloud there is no operating system for you to configure, so the steps above do not apply. It is one MetaTrader 4 or 5, already running, opened in the browser, for one trading account with unlimited Expert Advisors. From the service page in the client area you can start, stop, restart or reinstall the MetaTrader; if it is not running, start it there. The MetaTrader settings of Step 3 (AutoTrading on, EAs attached to their charts) are still yours to check.

Metatrader VPS runs an Ubuntu desktop, not Windows, so the Windows steps on this page do not apply to it, and this page does not cover autostart on Ubuntu.

FAQ

Do I need automatic logon if the shortcut is already in the Startup folder?

Yes. The Startup folder runs only when a user signs in. Without automatic logon the terminals start only when you connect with Remote Desktop yourself.

My autostart stopped working after I changed the VPS password. Why?

Automatic logon still holds the old password, so the sign-in fails at boot. Run Autologon again with the new password. Dipgate's knowledge base gives the same advice for its VPS.

Will my EA remember its open trades after the restart?

The trades stay on the broker's server and the EA settings stay on the chart. What the EA does with its own internal counters after a restart depends on how it was written, so ask the vendor.

Should I sign out of the VPS when I finish?

No. Signing out closes your programs, MetaTrader included. Close the Remote Desktop window instead: that disconnects and leaves the terminals running.

Is shell:startup or shell:common startup better?

shell:startup applies to the signed-in user only; shell:common startup applies to any user who signs in to that machine. On a VPS with one Administrator user either works; pick one and keep each shortcut in one place only.

Do I have to do this on Metatrader In Cloud?

No, and you could not: there is no operating system for you to set up, only the MetaTrader in the browser. You start, stop, restart or reinstall it from the service page in the Dipgate client area; if you find it stopped, start it there.