Key points
- Stop loss, take profit and pending orders are stored at your broker and work even when your PC is off.
- Everything an EA does itself (partial closes, break-even moves, trailing, alerts) stops while MT5 is not running.
- Trades you open on your phone are managed only if an EA is running on a PC or VPS for the same account.
- A VPS is a rented Windows computer that is always on; it is the usual solution.
Why an EA stops when your PC stops
MetaTrader 5 has two parts: your terminal (the program on your PC) and your broker's trade server. An Expert Advisor lives in the terminal. It watches prices and sends orders to the server. When the terminal is closed, frozen or offline, or the PC is asleep, the EA simply does not run. No program can work inside a sleeping computer.
What keeps working, and what stops
| What | Stored where | PC asleep, off or offline |
|---|---|---|
| Stop loss of a trade | Broker server | keeps working |
| Take profit of a trade | Broker server | keeps working |
| Pending orders (limit, stop) | Broker server | keep working |
| Partial closes at several levels | EA in your terminal | stop |
| Moving the stop to break-even | EA in your terminal | stops |
| MT5's built-in trailing stop | Your terminal | stops |
| Alerts to your phone from the EA | EA in your terminal | not sent |
Even orders at the broker are not guaranteed prices: in fast markets and gaps a stop can be filled at a worse price.
What about trading from your phone?
The MetaTrader 5 phone app can open, change and close trades, and receive alerts, but it cannot run Expert Advisors. A trade you open on your phone is still managed by your EA, as long as MT5 with that EA is running on a PC or VPS logged in to the same account. Think of the phone as a remote control and the PC or VPS as the engine.
Option 1: keep your Windows PC awake
- Start → Settings → System → Power & battery (Windows 10: Power & sleep) and set sleep when plugged in to Never. The screen may still turn off; that does not stop MT5.
- On a laptop: keep it plugged in and set what closing the lid does to Do nothing (type "lid" in the Windows search box).
- Set Windows Update → Advanced options → Active hours, so updates do not restart the PC while you trade.
- Keep a stable internet connection and power. A power cut or router restart stops the EA too.
Option 2: run MT5 on a VPS
A Virtual Private Server is a Windows computer in a data centre that runs 24 hours a day. You connect to it with Remote Desktop, install MT5 and your EA there, and log in to your trading account. What to look for:
- Windows (MT5 desktop needs it) with at least 2 GB of memory for one or two terminals.
- A data centre close to your broker's server for low delay; MT5 shows the ping in the bottom-right corner.
- Reliable uptime and support. Prices usually start at a few dollars a month.
MetaTrader also offers its own built-in hosting service. Check with your EA's maker whether all of its functions work there.
If the same EA runs on your PC and on a VPS for the same account, both may act on the same trade, for example closing the same partial twice. Run it on the VPS, and use the PC and phone only to watch.
What happens when the PC comes back
A well-built EA continues from where it stopped: it reloads what it already did on each trade and catches up with the current price. It cannot undo what happened while it was off: a level the price touched and left again in the meantime is not taken afterwards. Check your trades whenever your PC was asleep.
Gold Position Manager places each trade's stop loss at your broker, and it can also give the last take-profit step to the broker, so both work even while your PC is off. Every step is saved before each close, so after a restart it continues where it left off and never takes the same step twice. If your PC was asleep while a trade was open, it tells you on the panel and can send an alert to your phone. It is honest about the limit: take-profit steps and break-even need MT5 running, so for trading away from your desk we recommend a VPS. Where it runs.
Questions
Do MT5 Expert Advisors work when the computer is off?
No. The EA runs in the MT5 terminal on your computer and stops with it. Only orders already at the broker, such as stop loss, take profit and pending orders, keep working.
Does my stop loss still work if I close MT5?
Yes. A stop loss that is already set on a trade is held by your broker and works when MT5 is closed. It can still be filled at a worse price in fast markets or gaps.
Do I need a VPS to use an EA?
Not if your PC stays on and connected while you trade. If you want the EA to work while your PC is off, or you trade mostly from your phone, a VPS is the usual solution.
Sources
This guide is education, not financial advice. Computers, internet connections, VPS providers and brokers can all fail; always be ready to manage your trades yourself. Trading gold carries a high risk of loss.