Home / Blog / Does an EA keep trading when MT5 is closed or the PC is off?

Does an EA keep trading when MT5 is closed or the PC is off?

In short: No. When MT5 is closed or the PC is off, the EA stops. To keep it trading around the clock, run MT5 on an always-on computer or a VPS.

EA and a closed MT5: 24/7 An EA trades only while MT5 is open and connected; a VPS keeps it running
24/7 An EA trades only while MT5 is open and connected; a VPS keeps it running

No. An MT5 Expert Advisor runs inside the terminal, so it works only while the terminal is open, connected and allowed to trade. Close MT5 or switch the PC off and the EA stops at once. What the broker's server already holds, such as stop-loss levels, take-profit levels and pending orders, stays and keeps working.

Our VPS guide covers how to set a server up; this page covers whether you need one. Facts come from MetaQuotes and Microsoft documentation read on 8 October 2026; the phone question is the one place where the documentation is silent, and it says so there. The worked example is arithmetic of grid settings from our free grid calculator, calculated on 8 October 2026, not a forecast.

On this page (10)

Short answer: what stops, and what keeps going?

When the MT5 terminal is closed or the PC is off, an Expert Advisor's own code stops: no new grid orders, no exit the EA manages, no lock, no alerts. Positions, stop-loss and take-profit levels and pending orders held on the broker's server stay and keep working.

Where a function lives decides whether it survives. This is the rule for a typical EA; yours may differ.

PieceWhere it runsTerminal closed or PC off
EA code: new grid orders, lock, exit logic, alertsYour terminalStops
Built-in trailing stopYour terminalStops; only the last stop level it set still works
Open positionsBroker's serverStay open
Stop-loss and take-profit attached to a positionBroker's serverStay and trigger
Pending ordersBroker's serverStay and trigger
Stop-out when margin runs shortBroker's serverStill happens
Push notifications set to "from the trade server"Broker's serverStill sent for trades, if your broker supports them

A take-profit the EA checks in its own code on every price tick sits on your side of the table. One attached to the order sits on the broker's side. Ask the EA's author which one yours is.

What is an Expert Advisor in MT5, and what actually runs it?

An Expert Advisor (EA) is a program that runs inside the MetaTrader 5 terminal, attached to a chart, and sends orders by fixed rules. The terminal runs it: an attached EA is loaded into the terminal and waits for events from it, such as a new price, a timer or a trade result (MQL5 reference). No terminal, no events, no EA. The grid EA glossary defines EA, .ex5, .set and Algo Trading.

It needs three things at once: a running terminal (a sleeping PC runs no programs), a connection to the broker, and permission to trade, meaning the AutoTrading button and the EA's own permission (MetaTrader 5 Help). Automated trading is disabled in MT5 covers the last one.

Think of a posted letter and an errand. A stop-loss on the server is a letter already in the post: delivered whether or not you are home. An EA is you running the errand in person every few seconds.

A stop is not always the end. The MQL5 reference says an EA attached to a chart before shutdown is loaded again when the terminal starts, and MT5 can log in to the last account by itself if the login was saved (MetaTrader 5 Help). The catch is Windows: after updates it restarts outside "active hours", by default 8:00 to 17:00 on PCs, and you can change them (Microsoft Learn). A restart at night is normal, and a terminal that does not start by itself stays closed until you sit down.

What happens to open positions when the EA stops?

When an MT5 EA stops, open positions stay open: positions, stop-loss and take-profit levels and pending orders are records on the broker's server. The Help says an EA runs on the user's PC and cannot manage positions after a computer failure or a lost connection, that Stop Loss and Take Profit are stored and executed on the server, that the broker executes a pending order even if the platform is closed, and that closing at stop-out is processed on the server too (MetaTrader 5 Help). The built-in trailing stop is the exception: it runs in the platform, and with the platform off only the stop level it last set can trigger (MetaTrader 5 Help).

So nothing is cancelled. Two things change: nobody adds, and nobody exits.

Worked example, lights out at order five. Cent account, $1,000, buys on gold from $4,170, start lot 0.01, ×2, step $1.95, 11 orders, leverage 1:100, stop-out 40%. Five orders are open, 0.31 lot in all (the basket), so each $1 against it costs $0.31. A running EA would open order six $9.75 below the first entry and carry on to 20.47 lots.

Gold below first entryEA running: lots / floating lossEA stopped after order 5: lots / floating loss
$15.002.55 / $8.260.31 / $2.74
$19.50 (order 11 opens)20.47 / $39.700.31 / $4.13
$49.7320.47 / $658.51 (stop-out)0.31 / $13.51

The model ignores spread, slippage and gaps.

A stopped EA freezes the grid where it stands, so exposure stops growing. That is not protection. The frozen basket has no exit of its own: its break-even is $6.16 below the first entry, and if gold returns there, an exit the EA manages in its own code, such as a trailing exit, cannot close it. If gold keeps falling, no lock arms and the EA sends no alert, because the code that would do these things is not running. You also do not choose the moment: an EA can stop at order two or ten. The full basket carries $20.47 per $1 of gold on a cent account, watched or not.

Can I run an MT5 Expert Advisor on an Android phone or iPhone?

MetaQuotes' pages for the MT5 apps on Android and iPhone do not mention Expert Advisors, and forum users report the apps do not run them, but no MetaQuotes page we read says so outright. Use the phone for watching the account and alerts; the EA runs in a desktop terminal on a PC or VPS.

MetaQuotes' pages for the MetaTrader 5 apps list placing and closing orders, charts, 30 indicators, alerts and push notifications, and do not mention Expert Advisors (Android, iPhone). MQL5 forum users say the apps do not run EAs (2023 thread, 2017 thread), but those are user posts, and as of 8 October 2026 no MetaQuotes page we read says it outright. Check your own app for an option to attach an EA.

The phone is good for watching: balance, equity, positions and push alerts. Both app pages say push notifications come from the desktop platform, so the alerts an EA sends stop with its terminal; our monitoring guide covers linking the phone and warns that a push can arrive late or not at all. There is one exception: the Help describes an option, "Notifications from the trade server", where the broker's server sends the message. You then still get, for example, a note that a take-profit closed a position while your computer is off. It covers orders, deals and balance operations, not an EA's own warnings, and availability depends on the broker (MetaTrader 5 Help). A remote-desktop app on a phone can reach a PC or VPS, but the EA runs there.

What are the three ways to keep an EA running?

There are three ways to keep an MT5 EA running while you are away: an always-on PC, a rented Windows VPS, or MetaTrader Virtual Hosting. The table compares them; the details follow.

OptionWhat it isLimits to know
Always-on PCYour own computer, set never to sleepSleep, hibernate and lid settings; Windows update restarts
Rented Windows VPSThe same terminal on another computerDisconnecting a Remote Desktop session keeps programs running, logging off ends them; read the provider's terms for uptime
MetaTrader Virtual HostingA round-the-clock service rented from the terminalNo DLL calls, WebRequest needs a trusted-address list, scripts do not migrate, an expired rental deletes the hosting data

Always-on PC. Set sleep and hibernate to "never" while plugged in, a laptop's lid action to do nothing (Windows power settings: Settings → System → Power, and Control Panel → Power Options for the lid; names vary by Windows version), and choose update restart times yourself.

Rented Windows VPS. The same terminal on another computer. Disconnecting a Remote Desktop session leaves its programs running (tsdiscon); logging off deletes the session and ends them (logoff). Setup and example providers (referral links, not a ranking) are in our VPS guide. We state no uptime figure; read your provider's terms.

MetaTrader Virtual Hosting. A service for round-the-clock operation of the platform, rented from the terminal (MetaTrader 5 Help). Read the limits first: DLL calls are forbidden, WebRequest needs permission and a list of trusted addresses, scripts do not migrate, migrating switches AutoTrading off in your local terminal (migration), and an expired rental deletes the hosting data (rental).

Do you need a VPS for an MT5 EA, and what does it not fix?

A VPS is needed only if the EA must trade while your own computer is off or asleep. It fixes what belongs to your computer: sleep, a closed lid, home power and internet cuts, an unplanned restart. It does not fix:

  • The strategy. Basket depth, margin and stop-out are the same on a server as at home.
  • Restarts on the server. Providers do maintenance and Windows updates too; set the terminal to start at login, as our VPS guide says.
  • A lost connection or a lapsed rental. Either means no trading.
  • Silence. A terminal that is down sends no EA alerts, so a quiet phone can look like a calm market.

What should you check before you leave?

  1. Sleep is off while plugged in; a laptop's lid does nothing.
  2. Updates restart on your terms. Set active hours or pick the restart time yourself, and avoid a restart while a basket is open.
  3. The terminal starts by itself. Windows signs in, MT5 is in the startup items, the login is saved. Test it on a demo account: restart the PC and watch the EA return on the chart.
  4. AutoTrading is on, the EA is allowed, the Experts tab is quiet. See the disabled-trading article above and MT5 EA error codes.
  5. A phone alert has been tested (Tools → Options → Notifications, then confirm a message really arrives), and the rental end date is in your calendar.

After any outage, look at the positions before you click anything: orders closed or added by hand can confuse an EA that keeps its own record of the basket.

If the EA is Midas (an MT5 Expert Advisor for gold on hedging cent accounts, Windows only): its FAQ answers "Do I need a VPS?" with "in practice, yes", because the EA has to stay online overnight and through weekend gaps; the software does not technically require one, and a stable connection is on you. Its troubleshooting page says it does not lose its place after a lost connection or a VPS reboot, because MT5's order history and the broker's server are the source of truth; what you must guard against is a terminal that does not restart by itself. Its install guide has you allow https://lic.midasgrid.com in the WebRequest list, and its help pages describe only a Windows VPS, not Virtual Hosting, so ask @MidasGridBot before assuming it runs there.

What can go wrong?

  • A frozen basket is still a risk. Positions stay open, margin stays held, stop-out still applies.
  • You may not know. A switched-off terminal sends no EA alerts.
  • A restart at a bad moment. What an EA does after missing price moves is its own logic; test it on a demo account.
  • The strategy risk stays. A cent account makes numbers small, not risk. How to evaluate a gold EA lists what to ask before funding one.

This is arithmetic of the settings, not a forecast. Trading with leverage carries risk: if the deposit is too small, a stop-out is possible. Size your deposit with a safety margin. Nothing here is individual investment advice. More in Risk, plainly.

Sources

Retrieved 8 October 2026: MQL5 reference, program running; MetaTrader 5 Help on Expert Advisors, performing deals, trading concepts, authorization, platform settings, Virtual Hosting, migration and server rental; MetaQuotes app pages for Android and iPhone; Microsoft Learn on restarts after updates, disconnecting a session and logging off; MQL5 forum user threads on mobile apps (2023, 2017), used only as user posts. Midas pages are the ones linked in the text.

FAQ

Does an EA keep trading when MT5 is closed or the PC is off?

No. An MT5 Expert Advisor runs inside the terminal, so when MT5 is closed or the computer is off, asleep or disconnected, the EA does nothing. Positions, stop-loss and take-profit levels and pending orders already held by the broker stay, and the broker's stop-out still applies. To run while your own computer is off, an EA has to run on another machine that stays on, such as a Windows VPS.

What happens to my open trades if I turn off my computer?

They stay open on the broker's server, with any stop-loss, take-profit and pending orders already attached. What stops is everything the EA does itself: new grid orders, exits it manages, a lock, its alerts. The built-in trailing stop also stops, leaving only the stop level it last set. The account keeps moving with the price. Trade notifications from the broker's server still arrive, if enabled and supported.

What is an Expert Advisor (EA) in MT5, and how does a forex trading robot work?

An Expert Advisor is a program that runs inside the MetaTrader 5 terminal, attached to a chart, and sends orders by fixed rules. It works only while three things hold at once: the terminal is running, it is connected to the broker, and trading is allowed, meaning the Algo Trading button and the EA's own permission. Close the terminal and the EA stops.

Can I use an Expert Advisor in the MT5 mobile app on Android or iPhone?

MetaQuotes' pages for the MT5 apps list placing and closing orders, charts, indicators, alerts and push notifications, and do not mention Expert Advisors. Forum users report the apps do not run them, but those are user posts, and no MetaQuotes page we read says it outright, so check your app. The phone is a window onto the account; the EA runs in a desktop terminal on a PC or VPS.

Do I need a VPS for an MT5 EA, and what is a MetaTrader VPS?

Only if the EA must trade while your own computer is off or asleep. "MetaTrader VPS" is used two ways: MetaQuotes' Virtual Hosting is a service built into the terminal that runs your migrated EAs on its servers, paid through an MQL5.community account, while a normal Windows VPS is a whole remote computer you control. Virtual Hosting forbids DLL calls and needs a WebRequest list, so check your EA against both.