If a trade in your MetaTrader terminal was closed automatically, it is typically caused by one of three reasons:
1. A Stop-Out was triggered on your account
When your account losses reach a critical point, MetaTrader automatically closes your positions to protect your account balance from going negative. This forced closure is called a Stop-Out.
Trigger condition: A Stop-Out is initiated when your margin level drops to 50% or lower. The system begins closing your open positions automatically, typically starting with the ones carrying the largest losses.
Tracking margin level: You can monitor your margin level under the "Trade" tab in the "Terminal" window (in MT4) or "Toolbox" window (in MT5). It is calculated using the formula:
Margin Level (%) = (Equity / Margin) * 100
Account history marker: Under the "Account History" tab in the "Terminal" window (in MT4) or "History" tab in the "Toolbox" window (in MT5), a trade closed by Stop-Out will display a comment such as [stopout] or [so].
2. An Expert Advisor or trading robot is active
An Expert Advisor (EA) is an automated trading program that opens and closes trades independently according to a preset strategy.
Visual indicator: If an EA is active, its name and status icon appear in the top-right corner of your chart. You can also check whether automated trading is permitted by looking at the "AutoTrading" (MT4) or "Algo Trading" (MT5) button in the main toolbar.
Account history marker: Many EAs leave automated notes in the "Comment" column under the "Account History" tab (in MT4) or "History" tab (in MT5), though some EAs may have this logging feature disabled in their settings.
Check your chart indicators and the "Comment" column in your account history to verify whether an EA closed the position.
3. A Stop-Loss or Take-Profit target was reached
When opening or managing a trade, you can set automatic exit parameters:
Stop-Loss (SL): Limits your loss by closing the trade automatically if the price moves against your position.
Take-Profit (TP): Secures your gain by closing the trade automatically once the price hits your profit target.
Once these price levels are set, the server executes the closure automatically when the market reaches your specified rate, even if your terminal is closed or you are offline.