You can set up MT4 or MT5 to start automatically after a VPS restart, so you don’t have to log in and launch your trading platform manually every time. With the right Windows settings, MetaTrader can reopen your charts, reconnect to your broker, and let your Expert Advisors (EAs) resume trading.
Imagine your VPS restarts overnight for a Windows update. The server comes back online a few minutes later, but MetaTrader never opens. Your EAs are sitting idle, and you might not notice until the next morning, or even after the weekend.
In this guide, we’ll walk through the setup on Windows Server 2019, 2022, and 2025. It should take around 15 to 30 minutes, depending on your VPS configuration.
Here’s what we’ll cover:
- Set Windows to log in automatically after a restart.
- Make MT4 or MT5 launch when Windows logs in.
- Check that your EAs can resume trading.
- Restart your VPS to test everything.
You don’t need to be a Windows expert. We’ll explain each step, including which settings to use and what to check if something doesn’t work.
Why Doesn’t MetaTrader Start Automatically After a VPS Restart?
MT4 and MT5 don’t normally restart by themselves because they’re desktop applications, not Windows services.
When your VPS restarts, Windows may stop at the login screen and wait for someone to sign in. Until that happens, your usual desktop startup applications won’t launch.
That means your VPS could be running perfectly while your trading platform remains closed.
To fix this, three things need to happen automatically:
- Windows signs in: Your VPS logs into a designated Windows account after restarting.
- MetaTrader opens: Windows launches MT4 or MT5 without you having to click anything.
- Your EAs resume: MetaTrader reconnects to your trading account and loads your saved charts and Expert Advisors.
Once all three are configured, you won’t need to manually start MetaTrader after every routine VPS restart.
One important note: this setup helps MetaTrader recover from a Windows restart. It doesn’t eliminate trading interruptions while the VPS is offline, guarantee that an EA will recover its previous state, or automatically fix broker connection problems.
Step 1: Set Windows to Log In Automatically
The first step is to configure Windows to sign in automatically whenever your VPS restarts.
We recommend creating a separate standard Windows account for trading rather than using the built-in Administrator account.
This keeps your everyday trading environment separate from the account you use to manage your server.
1. Create a Windows Account for Trading
We’ll call the account trader throughout this guide, but you can choose another name.
If you already have a suitable Windows account, you can skip this part.
First, connect to your VPS using Remote Desktop and sign in with an administrator account.
Then:
- Open the Start menu.
- Search for PowerShell.
- Right-click Windows PowerShell and select Run as administrator.
- Copy and run the following commands:
$pw = Read-Host -AsSecureString "Password for trader"
New-LocalUser -Name "trader" -Password $pw -PasswordNeverExpires
Add-LocalGroupMember -Group "Remote Desktop Users" -Member "trader"
Windows will ask you to create a password for the new account.
Choose a password and store it somewhere secure.
The commands create a standard Windows user called trader and allow it to connect through Remote Desktop.
Note: The PasswordNeverExpires setting helps prevent an expired password from interrupting automatic login. Because of this, it’s particularly important to use a strong password and protect access to your VPS.
2. Download Microsoft Autologon
Next, we’ll use a free Microsoft tool called Autologon to make Windows sign in automatically.
You can get it from the official Microsoft website:
Download Microsoft Sysinternals Autologon
Once downloaded:
- Extract the ZIP file.
- Find
Autologon64.exe. - Right-click it and select Run as administrator.
- Accept the license agreement if prompted.
You’ll see a small window asking for your login details.
3. Enable Automatic Login
Enter the following information:
| Field | What to enter |
|---|---|
| Username | trader |
| Domain | Your VPS computer name |
| Password | The password you created for trader |
Not sure what your VPS computer name is?
Open PowerShell and run:
$env:COMPUTERNAME
Copy the name that appears and enter it in the Domain field.
Now click Enable.
That’s it. Windows is configured to try signing in as trader after the next restart.
You can also turn automatic login off later by reopening Autologon and clicking Disable.
Is Automatic Login Safe?
Automatic login is convenient, but it comes with a security trade-off.
Microsoft Autologon stores your login credentials in an encrypted form rather than as a plain-text registry password. However, someone with administrator-level access to your server may still be able to recover them.
Also, your trading desktop may already be signed in when someone opens the VPS console.
For that reason, we recommend:
- Protecting your VPS provider account with a strong password and two-factor authentication.
- Limiting who has administrator or console access.
- Using a dedicated Windows account for MetaTrader.
- Keeping Windows, MetaTrader, and your security software updated.
If your company or VPS provider doesn’t allow automatic login, check its security policy before enabling this feature.
Step 2: Make MT4 or MT5 Start Automatically
Once Windows can log in automatically, the next step is to make MetaTrader open as soon as that login happens.
Before continuing, sign in to Windows as trader.
If you haven’t installed MetaTrader yet, download MT4 or MT5 from your broker’s official website and install it under this Windows account.
Open MetaTrader once, sign in to your broker account, and confirm it runs normally.
Now you have two ways to automate startup.
| Option | Best for | What it does |
|---|---|---|
| Option A: Startup folder | Most traders | Opens MetaTrader when Windows logs in |
| Option B: Task Scheduler | Traders who want extra recovery protection | Opens MetaTrader at login and checks periodically whether it has closed |
We recommend Option A if you just want a simple, reliable way to start MetaTrader after a reboot.
Choose Option B if you’d also like Windows to reopen MetaTrader when the application crashes or exits unexpectedly.
You only need one option.
Option A: Use the Windows Startup Folder (Easiest)
The Startup folder is the simplest way to launch MT4 or MT5 automatically when Windows signs in.
Windows checks this folder when you log in and opens the programs linked inside it.
Here’s how to set it up.
1. Open Your Startup Folder
While signed in as trader, press Win + R.
Type:
shell:startup
Press Enter.
A folder will open. This is the Startup folder for your current Windows account.
2. Find Your MetaTrader Program
Open File Explorer and navigate to where MetaTrader is installed.
You’ll usually find it under:
C:\Program Files\
The exact folder name depends on your broker.
Look for one of these program files:
- MT4:
terminal.exe - MT5:
terminal64.exe
If you’re unsure where MetaTrader is installed, right-click its existing desktop shortcut, choose Properties, and check the Target field.
3. Create a Shortcut in the Startup Folder
Right-click an empty area inside the Startup folder and select New > Shortcut.
Click Browse, select the MetaTrader program file, and click Next.
Give the shortcut a recognizable name, such as MT5 Auto Start, then click Finish.
If your existing MetaTrader desktop shortcut includes special startup parameters, such as /portable, copy that shortcut instead so you don’t lose those settings.
4. Test the Shortcut
Double-click the new shortcut.
MetaTrader should open normally, with the correct trading account and charts.
If it does, your Startup folder is ready.
The next time Windows signs in as trader, it should automatically launch MetaTrader.
One thing to remember: This method starts MetaTrader when you log in. If MetaTrader crashes several hours later, the Startup folder won’t reopen it automatically.
If you’d like that extra protection, use Option B instead.
Option B: Use Task Scheduler to Restart MetaTrader After a Crash
Task Scheduler can launch MetaTrader when you sign in and check every five minutes whether the application is still running.
If MetaTrader has closed, Windows can reopen it without you having to connect to your VPS.
This is useful when you’re running EAs around the clock and want an extra layer of protection.
We’ll set it up using a short PowerShell script.
1. Create a PowerShell Script
First, create a folder on your VPS called:
C:\Scripts
You can do this in File Explorer.
Next, open Notepad and paste the following script:
$terminals = @(
"C:\Program Files\MetaTrader 5\terminal64.exe"
# "C:\Program Files (x86)\MetaTrader 4\terminal.exe"
)
foreach ($exe in $terminals) {
if (-not (Test-Path -LiteralPath $exe)) {
Write-Warning "MetaTrader not found: $exe"
continue
}
$running = Get-Process -Name terminal, terminal64 `
-ErrorAction SilentlyContinue |
Where-Object { $_.Path -eq $exe }
if (-not $running) {
Start-Process -FilePath $exe `
-WorkingDirectory (Split-Path $exe)
}
}
Change the example file path to the actual location of MetaTrader on your VPS.
If you’re using MT4 instead of MT5, replace the MT5 path with your MT4 installation path.
If you’re running several separately installed MetaTrader terminals, you can include each program path on its own line. Remove the # at the beginning of any example line you want to activate.
How does the script work?
It checks whether each listed MetaTrader program is already running.
- If MetaTrader is open, the script leaves it alone.
- If MetaTrader is closed, the script launches it.
- If the configured file doesn’t exist, the script shows a warning instead of trying to open it.
This helps prevent the task from launching duplicate copies of the same installation.
The script checks whether the process exists. It can’t detect every type of frozen or unresponsive application.
Also, if you run multiple terminals from the same executable path with different configurations, you’ll need a more specific setup to identify each instance correctly.
Save the file as:
C:\Scripts\start-mt.ps1
In Notepad, choose Save as type > All Files so the file doesn’t accidentally become start-mt.ps1.txt.
If your installation uses portable mode, make sure your startup script also passes the /portable argument and that the trader account has permission to write to the terminal’s data folder.
2. Create the Scheduled Task
Now let’s tell Windows when to run the script.
- Open the Start menu and search for Task Scheduler.
- Open Task Scheduler and select Create Task.
- Enter
MetaTrader Autostartas the task name.
Under the General tab:
- Select the Windows user
trader. - Choose Run only when user is logged on.
- Leave Run with highest privileges unchecked unless your particular setup genuinely requires elevated access.
The first setting matters because MetaTrader needs to run in the interactive Windows user session.
3. Add the Login Trigger
Open the Triggers tab and click New.
Set:
- Begin the task: At log on
- Specific user: trader
You can optionally enable a delay of 30 seconds to give Windows time to finish loading after login.
Click OK.
4. Add a Repeating Trigger
Still under Triggers, click New again.
Set:
- Begin the task: On a schedule
- Settings: One time
- Start: A suitable current or upcoming time
- Repeat task every: 5 minutes
- For a duration of: Indefinitely
Make sure the trigger is enabled, then click OK.
If your Windows version doesn’t offer an indefinite duration, use a daily trigger that repeats every five minutes for one day, with the schedule recurring daily.
5. Tell Windows Which Script to Run
Open the Actions tab and click New.
Set Action to Start a program.
In Program/script, enter:
powershell.exe
In Add arguments, enter:
-NoProfile -ExecutionPolicy Bypass -WindowStyle Hidden -File "C:\Scripts\start-mt.ps1"
Click OK.
6. Check the Task Settings
Under Conditions, make sure the task won’t be restricted by power conditions that don’t apply to your VPS.
Under Settings, enable Allow task to be run on demand and choose Do not start a new instance if the task is already running.
Save the task.
Task Scheduler may request account credentials or administrative approval, depending on your configuration.
You should now see MetaTrader Autostart in your Task Scheduler Library.
7. Test the Task
While signed in as trader, close MetaTrader normally.
In Task Scheduler, right-click MetaTrader Autostart and select Run.
MetaTrader should open.
You can then close MetaTrader again and verify that the repeating trigger launches it on its next check.
If nothing happens, check the task’s Last Run Result and History tabs, and make sure the script path is correct.
8. Pause Automatic Restarts During Maintenance
There’s one important detail with Option B.
If you close MetaTrader to install an update, change an EA, or troubleshoot a problem, Task Scheduler may reopen it within five minutes.
To avoid that, disable the task before doing maintenance.
You can do this in Task Scheduler by right-clicking the task and choosing Disable.
Or use PowerShell:
Disable-ScheduledTask -TaskName "MetaTrader Autostart"
When you’re finished, turn it back on:
Enable-ScheduledTask -TaskName "MetaTrader Autostart"
You can also manually run the task again when you’re ready.
Important: Use either the Startup folder or Task Scheduler, not both. Running both can cause unnecessary duplicate startup attempts.
Step 3: Make Sure Your EAs Resume Trading
Getting MetaTrader to open automatically is only half the setup. You also need to make sure your Expert Advisors are ready to trade when the platform restarts.
Otherwise, you could end up with MT4 or MT5 running perfectly but none of your trading strategies actually working.
Let’s go through the key settings.
1. Save Your Broker Login Details
Open MetaTrader and sign in to your trading account.
Make sure the option to save your password or account information is enabled, if your version provides it.
This allows MetaTrader to reconnect without asking you to log in manually every time.
After restarting MetaTrader, check that it’s connected to the correct broker server and trading account.
If your broker requires additional authentication after a restart, you may need to complete that separately.
2. Enable Automated Trading
In MetaTrader, go to:
Tools > Options > Expert Advisors
Look for the setting that allows automated or algorithmic trading.
Enable it.
Next, check the main trading button on the MetaTrader toolbar:
- MT4: AutoTrading
- MT5: Algo Trading or AutoTrading, depending on your version
Make sure automated trading is enabled.
If this setting is off, your EAs may load successfully but won’t be allowed to place trades.
3. Check Settings That Disable Trading Automatically
On the same Expert Advisors settings tab, you’ll see options that can disable automated trading when certain changes occur.
These may include:
- Disabling automated trading when you switch accounts.
- Disabling automated trading when you switch profiles.
- Disabling automated trading when you change a chart’s symbol or timeframe.
For a dedicated trading VPS where you want EAs to resume without manual intervention, review these settings carefully.
You may choose to disable the automatic restrictions that would otherwise interrupt your setup.
However, these options are also useful safety features. For example, preventing automated trading after switching accounts can help stop an EA from accidentally trading on the wrong account.
If you change these settings, make sure you verify your trading account, charts, and EA configurations before allowing live trading.
4. Check the Permissions for Each EA
Enabling automated trading globally doesn’t always mean every EA is allowed to trade.
Individual Expert Advisors can have their own settings.
For each chart running an EA:
- Open the EA’s properties.
- Check its trading permissions.
- Confirm its inputs and parameters are correct.
- Check whether it requires any additional permissions.
Some EAs may also need access to DLL libraries or specific websites.
Only grant these permissions when you trust the EA and understand why it needs them.
5. Save Your Charts and Profiles
MetaTrader normally restores your workspace, including the charts and attached EAs, using its saved profile data.
To help make sure the correct setup comes back after a restart:
- Open all the charts you normally trade.
- Attach your EAs and confirm their settings.
- Save your profile using File > Profiles > Save As, where available.
- Close MetaTrader normally using File > Exit.
- Reopen it and check that everything has been restored.
This simple test helps catch missing charts or unsaved settings before an unexpected restart happens.
Also, make sure you’re launching MetaTrader using the same Windows user and data location each time. Different Windows accounts or startup modes can load different sets of platform data.
6. Check Whether Your EA Can Recover After a Restart
This is an easy detail to overlook.
MetaTrader reopening doesn’t automatically guarantee that your EA will remember everything it was doing before the restart.
Some EAs are designed to recognize existing open positions and continue managing them.
Others may rely on information stored in memory, which can be lost when the application closes.
Before relying on automatic restarts, ask your EA developer or check its documentation:
- Can the EA recognize trades it opened before a restart?
- Will it continue managing open positions?
- Does it rebuild any internal trading state it needs?
- Could restarting cause it to open duplicate trades?
Ideally, test the EA’s restart behavior on a demo account before using the setup with live funds.
Step 4: Restart Your VPS and Test Everything
The best way to confirm that automatic startup works is to restart your VPS and check that MetaTrader comes back without your help.
Don’t wait for an unexpected Windows update to discover that something wasn’t configured correctly.
For the safest test, use a demo account or a period when markets are closed.
1. Restart the VPS
Save anything you’re working on, then open PowerShell and run:
Restart-Computer
Your Remote Desktop connection will close as Windows begins restarting.
That’s normal.
2. Give Windows Time to Restart
Allow a few minutes for Windows to start, automatically sign in, and launch MetaTrader.
The exact time depends on your VPS performance, Windows updates, and how many trading terminals you run.
You don’t need to connect immediately.
3. Reconnect to Your VPS
Use Remote Desktop to connect again with the trader account.
Check that you’re viewing the intended trading session and not a separate Windows session.
If MetaTrader is missing, check whether it’s running under another session before launching another copy.
4. Check Your MetaTrader Setup
Use this checklist:
- MT4 or MT5 opened automatically.
- Only the intended number of terminal instances are running.
- MetaTrader is connected to the correct broker server.
- The correct trading account is logged in.
- Automated trading is enabled.
- Your charts and EAs have loaded correctly.
- EA settings and inputs are correct.
- The Experts and Journal tabs show no unexpected errors.
If all these checks pass, your automatic startup setup is working.
Remember, an EA may still need a new market tick or another event before it starts processing trades. An open chart doesn’t always mean the EA has already performed its next action.
5. Disconnect Without Closing MetaTrader
When you’ve finished checking everything, disconnect from Remote Desktop rather than signing out of Windows.
The easiest way is to close the Remote Desktop window using the X button.
Disconnecting normally leaves your Windows session and its running applications active.
Signing out is different. It ends your session and closes applications such as MetaTrader.
If your VPS is configured to log off disconnected sessions automatically, you’ll also need to review that Windows policy.
For a trading VPS, this distinction matters a lot.
You want to disconnect from the VPS while leaving your EAs running.
Troubleshooting: What If MetaTrader Still Doesn’t Start?
If something isn’t working, don’t worry. Most automatic startup issues come down to a login setting, an incorrect file path, or MetaTrader loading the wrong configuration.
Here are the most common problems and what to check.
| Problem | Likely Cause | What to Do |
|---|---|---|
| Windows stays at the login screen | Autologon isn’t configured correctly, credentials changed, or a login notice is blocking it | Run Autologon again, verify the account details, and check Windows login policies. |
| MetaTrader doesn’t open | The shortcut or script points to the wrong executable | Check the full path to terminal.exe or terminal64.exe. |
| Two copies of MetaTrader open | More than one startup method or Windows session is launching it | Check the Startup folder, scheduled tasks, and active user sessions. |
| Task Scheduler isn’t opening MetaTrader | The task uses the wrong Windows user, action, or login setting | Select Run only when user is logged on, verify the script, and inspect task history. |
| MetaTrader opens but shows “No connection” | Saved login details are missing or the broker connection isn’t available | Check your account credentials, selected server, internet connection, and broker status. |
| MetaTrader opens with no EAs | The wrong profile or data directory was loaded | Check the active profile and make sure you’re using the same Windows account and startup mode. |
| MetaTrader opens as if newly installed | It may be using a different data directory or missing its original portable-mode settings | Compare the normal shortcut with the automatic startup command. |
| EAs are attached but aren’t trading | Automated trading is disabled or an EA-specific setting is blocking it | Check the toolbar button, Expert Advisors options, EA permissions, and Experts log. |
| MetaTrader closes after disconnecting | Windows may be logging off disconnected Remote Desktop sessions | Review your Remote Desktop session time-limit policies. |
| MetaTrader doesn’t restart after a crash | The Startup folder doesn’t monitor crashes, or the scheduled task isn’t repeating | Use Option B and check the task’s triggers and last run result. |
A Quick Note About Portable Mode
If your MetaTrader installation uses portable mode, it stores its configuration data differently from a standard installation.
You’ll need to make sure your automatic startup method uses the same mode.
For a Startup folder shortcut, this may mean including /portable after the executable path in the shortcut’s Target field.
For Task Scheduler, you’ll need to pass /portable when launching the program from your script.
Also, check that your Windows trading account has permission to write to the portable installation folder.
For a standard Windows user, it’s better to use a writable location outside protected folders such as C:\Program Files for portable installations.
What If Windows Closes My Session After I Disconnect?
If MetaTrader closes some time after you disconnect from Remote Desktop, Windows may be applying a session time limit.
To check this:
- Open Run using Win + R.
- Type
gpedit.mscand press Enter. - Navigate to Computer Configuration > Administrative Templates > Windows Components > Remote Desktop Services > Remote Desktop Session Host > Session Time Limits.
- Open Set time limit for disconnected sessions.
- Check whether Windows is configured to end disconnected sessions after a certain period.
If appropriate for your VPS and security requirements, configure the policy so disconnected sessions aren’t automatically ended.
Remember that domain policies or VPS provider settings may override local settings.
How Do You Know Your EAs Are Fully Protected?
Automatic startup reduces the risk of an extended trading interruption after a VPS restart, but it isn’t a complete monitoring or recovery system.
Even with everything configured correctly, unexpected problems can still happen.
For example, your broker might temporarily go offline, an EA might stop responding, or Windows could encounter a problem that prevents MetaTrader from launching.
For extra peace of mind, consider setting up a separate monitoring or notification system that alerts you when MetaTrader or your EAs stop operating as expected.
That way, you’re not relying entirely on automatic startup to keep your trading environment healthy.
Next Steps: Keep Your Trading VPS Running Smoothly
You should now have a VPS configured to start MetaTrader automatically after a normal Windows restart.
That means fewer manual logins and a better chance of getting your trading strategies back online promptly after an interruption.
Of course, the best restart is often the one that happens at a time you’ve planned for.
If you want more control over your VPS and trading setup, these guides are a good next step:
How to Use SoftEther VPN Client Manager on Windows: Profiles, Connections, and Troubleshooting
How to Migrate to Winserver – A Step-by-Step Guide
Run Your EAs on a Windows VPS Built for Uptime
A reliable VPS makes automated trading easier to manage, especially when you’re running EAs that need to stay online while your own computer is switched off.
Our Windows VPS plans are designed to give MT4 and MT5 traders a dedicated environment for running their platforms remotely, with the flexibility to configure automatic startup and manage multiple trading terminals.
Whether you’re running a single EA or several strategies, you can choose a VPS that fits your setup.
Explore Our Forex Windows VPS Plans
Keep your trading platform running without having to leave your home computer on all day.
Frequently Asked Questions About MT4/MT5 Automatic Startup
Can MT4 or MT5 start automatically after a VPS restart?
Yes. You can configure MT4 or MT5 to start automatically after a VPS restart by enabling Windows automatic login and adding MetaTrader to the Startup folder or Task Scheduler. Once configured, MetaTrader can reopen without you having to log in and launch it manually.
Will my Expert Advisors automatically resume trading after a VPS restart?
Yes, provided your EAs are configured correctly and support restarting. MetaTrader needs to reconnect to your broker, restore your charts, and have automated trading enabled. Some EAs may also need to recover information about previously opened trades, so it’s worth testing them on a demo account first.
Do I need to keep Remote Desktop connected for MT4 or MT5 to run?
No. You can disconnect from Remote Desktop while keeping MetaTrader and your EAs running on the VPS. Simply close the Remote Desktop window instead of signing out of Windows. Make sure your VPS isn’t configured to automatically log off disconnected sessions.
What happens if MetaTrader crashes while my VPS is still running?
If you use the Windows Startup folder, MetaTrader won’t automatically reopen after a crash. However, you can configure Task Scheduler to check whether MetaTrader is running every five minutes and relaunch it if the application has closed. This helps reduce downtime, although it won’t detect every type of application freeze.
Why does MetaTrader open after a restart but my EAs don’t trade?
This usually happens because automated trading is disabled, an EA doesn’t have trading permission, or MetaTrader hasn’t connected to your broker. Check the AutoTrading or Algo Trading button, review the Expert Advisors settings, and look for errors in the Experts and Journal tabs.
Can I automatically start multiple MT4 or MT5 terminals on one VPS?
Yes. You can run multiple MetaTrader terminals on one Windows VPS. Each terminal should have its own installation or configuration directory to avoid conflicts. Add a separate shortcut for each terminal to the Startup folder, or configure your Task Scheduler script to launch each installation. Make sure your VPS has enough RAM and CPU resources for all your terminals and EAs.
Will MetaTrader still restart automatically after a Windows update?
Yes, if Windows automatic login and MetaTrader startup are configured correctly. Once Windows finishes updating and restarts, it can sign in to your trading account and launch MetaTrader. However, some updates, login prompts, or security policies may interrupt the process, so it’s a good idea to check your setup after major Windows updates.
Is the Windows Startup folder or Task Scheduler better for MetaTrader?
The Startup folder is usually the easiest option because it launches MetaTrader whenever Windows signs in. Task Scheduler is better if you also want Windows to reopen MetaTrader after an unexpected application closure. For most beginners, the Startup folder is a good place to start.
Looking for a Japan-Based VPS?
If you regularly access Japanese online services from overseas, a Japan-based VPS gives you a dedicated remote Windows environment hosted in Japan. Compare available plans, resources, and connection options to find a setup that fits your needs.

