LagShield Pro
- 유틸리티
-
Dennis Muchiri Miano
I build MetaTrader 5 tools for my own trading and publish them on the MQL5 Market under DeeFX. I trade with the tools I build: a tool ships only after it has done its job on my own charts, so it can do the same job on yours.
What I build
- Risk and drawdown guards for prop-firm rules - 버전: 2.1
- 업데이트됨: 26 11월 2026
- 활성화: 10
LagShield Pro watches the chart it is attached to for two problems: quotes that stop arriving, and a connection to the trade server that is slow or lost. Green while all is well, amber when something is slow, red when it has lasted long enough to count as a lag. It has no strategy, opens no trades, and never closes anything by itself.
What counts as a lag
- No connection to the trade server for 3 seconds
- Quotes that stop for 3 seconds past the limit: 500 ms, or 3 times the symbol's usual gap between quotes, whichever is longer. A symbol that quotes slowly by nature is not a lag
- Gaps are judged while the market moves (ATR above 1.5 times its average); in a quiet market a pause is normal
- A closed market is not a lag
- Ping plus the last close's answer time above 150 ms is amber, never red
At a confirmed lag
- The terminal global variable Terminal_Lag_Detected is set to 1.0, and back to 0.0 when it ends. Name and values are the same as in version 1
- The panic button is armed, and stays armed for 60 seconds after the lag, when a close can get through again
- One alert when it starts and one when it ends, in the terminal and as a push notification if you switch that on
The panic button
- A click and a confirming second click close every trade in your scope: this chart's symbol or all symbols, one magic number or every trade, manual ones included. Pending orders too if you want
- Each close is logged with its ticket, symbol, floating result and the server's answer time
- If the connection drops while a close is on its way, the panel says the result is not known yet and checks again when the connection is back
- It can be set to work at any time, as an ordinary close button
For Expert Advisors
One line at the top of OnTick is enough: if(GlobalVariableGet("Terminal_Lag_Detected") >= 1.0) return;
How to use
- Attach it to the chart of the symbol you trade and allow Algo Trading. Leave that chart open
- Look at the Ping row. If your normal ping is above 150 ms, raise the safety threshold
- Choose what the panic button closes; the panel shows the scope and how many trades are in it
- Add the one line above to the EAs that should stand aside during a lag
Good to know
- It cannot close through a dead connection: a stop-loss at your broker protects a trade while you are cut off
- About 15 seconds after a reconnect MetaTrader may switch access points and drop the connection for a second; a click then is refused, and the panel says so. Click again
- It measures what this computer sees and cannot tell whether a delay came from the broker or from your line
- The flag is advice: an EA that does not read it trades on
- Strategy Tester: there is no real delay there, so a gap in the simulated quotes stands in for lag, and a demonstration opens one small trade a day and presses the panic button at a confirmed lag. Choose "Every tick based on real ticks": with "1 minute OHLC" nearly every gap is long, so the panel stays red. Those trades show the button working; they are not a strategy and their result means nothing. The mode never runs on a live chart and the last input switches it off. Alerts and push do nothing in the tester
- All its objects start with FXLS_ and are removed with the tool
Questions, bugs and ideas: post in the comments, or join the DeeFX Tools group on MQL5.

