Do stop-loss, take-profit and EAs work when MT4 is closed?
This is the question that shows up on every beginner forum: I set a stop-loss, I close my laptop and go to sleep — will it actually work? The answer is yes, but only because the stop-loss does not live inside your MetaTrader. It lives on the broker server, a hundred kilometres away, and it is that server which watches the price all night long. The catch is that not everything you see on the platform behaves the same way. A robot and a trailing stop are an entirely different story. Below I explain what really keeps running after you close the terminal, and what stops.
The broker server versus your terminal — where the order really lives
The whole difference comes down to one question: who executes a given order. Some orders live on the broker side of the line, and some on the client side, meaning the MetaTrader program on your own computer. That distinction decides what survives when the laptop goes dark. Stop-loss, take-profit and every pending order are written into the broker system. The moment you click "OK", your terminal sends those levels to the server, and from then on it is the server that monitors the market tick by tick.
In this arrangement your MetaTrader is only a window onto the market — a neat control panel that draws the chart and lets you place instructions. When you close it, the window disappears, but the orders that already reached the server do not. That is why you can safely switch off the computer, lose your internet connection or leave for the weekend, and the stop-loss and take-profit are still there, ready to fire. I break the individual order types down in a separate article on market, limit and stop order types.
What works with MT4 closed — stop-loss, take-profit, pending orders
Three things work on the server side, which means they are immune to the terminal being shut down. The first is the stop-loss — the level at which the broker automatically closes a losing position. The second is the take-profit, the equivalent level for realising a gain. The third is pending orders: buy limit, sell limit, buy stop and sell stop, which open a position only once the price reaches the level you set. All three are stored and enforced by the broker server, so they will fire regardless of whether your computer even exists at that moment.
This is the single most important fact for a beginner trader: your basic protection does not require you to sit at the screen. You set a stop-loss when you open the position, you close the platform, and that level guards the market for you. There is one exception to "always works", which I cover below — the price gap. A stop-loss does not vanish on a gap, but it can fill at a worse price than the one you set, and that is worth knowing before you leave large positions open over a weekend.
What stops working — Expert Advisor, trailing stop, alerts, scripts
On the client side, meaning only with the terminal open and connected, sits everything that MetaTrader calculates locally. The most important of these is the Expert Advisor — a program that reacts to every new price tick and places or modifies orders by itself. The robot receives ticks only while the platform is running, so once you close it the robot simply goes dormant. It opens no new positions, manages none of the open ones and does not react to the market until the next launch. I describe how robots work in the article on Expert Advisors.
The second client-side tool is the trailing stop built into MetaTrader. It is not a separate order on the server but a platform function that recalculates a new stop-loss level on every tick and sends it to the server. When you close the terminal, the trailing stops calculating — it leaves the last level it managed to set on the server and no longer moves it. The position is still protected by that final stop-loss, but the price-following mechanism is dead. I walk through that exact sequence in the article on how the trailing stop works. Price alerts and order-modifying scripts are client-side too — all of them need a live terminal.
"The Trailing Stop is executed in the trading platform rather than on the server (like Stop Loss or Take Profit). This is why it will not work, unlike the above orders, if the platform is off." — MetaQuotes Software Corp., *MetaTrader 5 Help: Trading Operations*, 2024.
An example: Marek leaves a position open overnight
Take a hypothetical example. On Wednesday evening Marek opens a long position on EUR/USD at 1.0865. He sets a stop-loss at 1.0810 and a take-profit at 1.0920, switches on a trailing stop with a forty-pip step, and attaches his own Expert Advisor that is meant to add to the position on a breakout. At eleven in the evening he closes the laptop and goes to sleep.
Here is what happens overnight: the stop-loss at 1.0810 and the take-profit at 1.0920 wait on the broker server in full readiness. Had the price dropped to 1.0810, the broker would have closed the position without any input from Marek. The trailing stop, however, froze the instant the computer shut down — if the price had ticked up before he fell asleep and the trailing had moved the stop-loss to 1.0840, that level stays, but it goes no further even if the rate climbs all night. The Expert Advisor sleeps along with the laptop and adds nothing to the position, even if a perfect breakout arrives in the morning. So Marek wakes up to a situation where his protection worked, but active management of the position had stood still since eleven the night before.
Nuances worth knowing — slippage, gaps and a server-side trailing stop
The first nuance is slippage on a price gap. A stop-loss guarantees that the position will be closed, but it does not guarantee the price. If the market opens on Sunday evening, or after a major release, far below your stop-loss, the broker closes the position at the first available price, which can be worse than the one you set. This is not a malfunction — it is normal market behaviour around a gap. The stop does not disappear; it simply fills with slippage.
The second nuance is a server-side trailing stop. Some brokers offer their own, server-side trailing mechanism that follows the price even with the terminal closed — but that is a specific broker's feature, not a standard MetaTrader function. Before you assume your trailing stop is running overnight, check the specification for whether it is server-side. The third nuance is the minor difference between MT4 and MT5: the server-versus-client logic is identical in both, but MT5 carries a richer set of order types and a slightly different way of handling positions. The principle itself does not change — whatever is calculated locally needs an open terminal.
What a VPS is actually for
A VPS, a virtual server, solves exactly this one problem: it keeps the MetaTrader terminal running around the clock, independent of your computer. You move the platform with its robot and trailing stop onto a machine in the cloud that sits close to the broker server and never switches off. As a result the Expert Advisor trades without interruption, and the trailing stop follows the price overnight and over the weekend, even though your laptop lies closed. It is a standard tool of the automated trader — without it, a robot is only useful for as many hours as you sit at the screen yourself.
If you trade purely by hand and your protection is a plain stop-loss and take-profit, a VPS changes nothing — the server holds those orders anyway. I lay out when a VPS genuinely earns its keep, and how to match it to the latency to your broker, in a separate article on VPS and broker latency. You will find a broader practical take on platforms and tooling in the platforms and tools section on forexmechanics.com.
What to do tomorrow
- Check what your position protection actually rests on. Open your most recent live position in MetaTrader and see whether it has a stop-loss and take-profit set as concrete levels, or only a trailing stop. If you rely on the trailing, remember that once the platform closes only the last level it set remains — so always add a hard stop-loss as a baseline level underneath it.
- Test for yourself what survives closing the terminal. On a demo account, set a stop-loss, a take-profit and a trailing stop, then close MetaTrader completely for a few minutes and open it again. You will see with your own eyes that the stop-loss and take-profit stand untouched, while the trailing has frozen at the last level from the moment the platform shut.
- Decide consciously whether you need a VPS. Write down every tool you use: if an Expert Advisor or a trailing stop that should run overnight is among them, a VPS is justified. If you trade by hand and accept a fixed stop-loss level until your next login, spare yourself the cost and stay on a plain terminal.
- Prepare for price gaps before the weekend. On Friday afternoon review your open positions and trim the risk on those you hold over the weekend, because the Sunday open can jump straight past your stop-loss. Assume the stop will fire but that its fill price may be worse than the level you set, and size the position so that such slippage is acceptable.
Sources & bibliography
-
MetaQuotes Software Corp. Basic Principles — Trading Operations, MetaTrader 5 Help · Oficjalna dokumentacja MetaTrader potwierdzająca, że trailing stop jest wykonywany w platformie, a nie na serwerze jak stop-loss i take-profit, i że dlatego nie zadziała przy wyłączonej platformie. www.metatrader5.com ↗
-
MetaQuotes Software Corp. Trailing Stop — Trading, MetaTrader 4 Help · Strona pomocy MT4 stwierdzająca wprost, że trailing stop działa w terminalu klienckim, a nie na serwerze, więc po wyłączeniu terminala zostaje tylko ostatnio ustawiony poziom stop-lossa. www.metatrader4.com ↗
-
MetaQuotes Software Corp. Program Running — MQL5 Reference · Dokumentacja MQL5 opisująca, kiedy Expert Advisor jest ładowany i uruchamiany w terminalu (między innymi przy starcie platformy), co potwierdza, że robot działa po stronie klienta. www.mql5.com ↗
-
MetaQuotes Software Corp. MetaTrader 5 Virtual Hosting · Opis usługi VPS MetaTrader, która zapewnia całodobową pracę platformy z Expert Advisorami i subskrypcjami sygnałów nawet przy wyłączonym komputerze tradera. www.metatrader5.com ↗
Frequently asked
Will my stop-loss trigger if I switch off the computer overnight?
Yes. Stop-loss, take-profit and pending orders are stored and executed by the broker server, not by the program on your computer. Once you set a stop-loss and close MetaTrader 4, that level still sits in the broker system and fires the moment price reaches it, whether your laptop is on or not. The same is true overnight, over the weekend and during an internet outage. The only thing that can happen is slippage on a price gap, when the market reopens far from your stop-loss level after a major release or over the weekend. The stop does not vanish in that case; it simply fills at the first available price, which can be worse than the level you set.
Why did my trailing stop stop following the price overnight?
Because the trailing stop in MetaTrader 4 is a client-side tool. The platform recalculates it locally on your computer, so the trailing stop only moves while the terminal is open and connected to the server. The moment you close MT4, switch off the machine or lose your internet connection, the trailing stop leaves the last stop-loss level it managed to set on the server and no longer moves it. Your position is still protected by that last level, but it no longer uses the price-following mechanism. If you need the stop to keep trailing through the night, the only options are to keep the terminal on a VPS or to use a server-side trailing stop, where your broker offers one.
Does an Expert Advisor keep trading after I close the platform?
No. An Expert Advisor is a program that runs inside the MetaTrader terminal, so it starts only when the platform launches and stops the moment you close it. The robot reacts to every new price tick, and it only receives ticks while the terminal is open and connected to the server. Once you switch off the computer, the EA opens no new orders, modifies none of the existing ones and no longer manages open positions. Whatever the robot previously wrote to the server, such as a stop-loss and take-profit, stays in place and will fire, but the decision engine itself is dead until the next platform launch. That is why automated traders move robots onto a VPS, where the terminal runs without interruption, independent of their own computer.
Do I need a VPS if I only use a plain stop-loss?
Usually not. If your position protection rests solely on a plain stop-loss, take-profit and pending orders, all of those sit on the broker server and will fire without your computer. A VPS only becomes necessary once you use client-side tools that have to run around the clock. That covers Expert Advisors trading without you present, a trailing stop that should follow price through the night, and scripts that modify orders in reaction to the market. If you trade manually, set a stop-loss when you open the position and accept that the protection level stays fixed until your next login, a VPS adds nothing but extra cost. The decision therefore comes down to whether any locally calculated tools are in play.