Daily Loss Limit Guard - Enforce Daily Loss Limits and Maintain Flat Account
Info
The Daily Loss Limit Guard - Enforce Daily Loss Limits and Maintain Flat Account is a Expert Advisor for MetaTrader 5 that daily loss limit guard this expert advisor enforces a single critical rule: no more than a specified percentage of loss in a single day. It is particularly useful for proprietary trading firm challenges and for any trader seeking a strict daily stop after a series of losses.
Usage
This tool is typically used for automated trading on major forex pairs and gold.
Platform
This Expert Advisor works exclusively on MetaTrader 5 (both build 600+ and newer versions).
Setup
Place the downloaded file in MQL5/Experts folder via File ? Open Data Folder in MetaTrader 5.
How to Install and Use Daily Loss Limit Guard - Enforce Daily Loss Limits and Maintain Flat Account
1. Installation: Open the "File" menu, select "Open Data Folder," navigate to MQL/Experts, paste your file, and restart the terminal.
2. Activation: Drag the EA from the Navigator onto a chart, ensure "Allow live trading" is checked in the Common tab, and verify the AutoTrading button is green.
3. Optimization: Right-click your chart, choose "Expert List," click "Properties" to adjust inputs, and save your preferred setup as a set file for future use.
4. Maintenance: Regularly check the "Experts" tab in the terminal window to monitor trade logs and potential execution errors.
Frequently Asked Questions
Q: Why is my EA not opening trades? A: Check the "AutoTrading" button, ensure "Allow live trading" is enabled, and verify your broker allows automated trading on your account type.
Q: Can I run multiple EAs on one chart? A: No, each chart can only host one active EA; however, you can open multiple charts for different currency pairs to run several EAs.
Q: What does the "smiley face" icon mean? A: A smiley face in the top-right corner of the chart indicates the EA is successfully running; a frowny face means it is disabled.
What this tool does
Daily Loss Limit Guard This Expert Advisor enforces a single critical rule: no more than a specified percentage of loss in a single day.
Typical Use Case
This Expert Advisor excels in automated trading and technical analysis on MetaTrader 5.
Compatible Platform & Setup
This Expert Advisor works on MetaTrader 5. Place the file in the MQL5/Experts folder and restart the terminal.
Description & Settings
Related: Ezo O Daily Loss Guard - Account-Wide Daily Loss Limit and Profit Target - another powerful expert for MetaTrader 5 traders.
Daily Loss Limit GuardAlso recommended: Risk Lot Line: Calculate Lot Size with Draggable Stop Loss - similar expert with strong performance on MetaTrader 5.
This Expert Advisor enforces a single critical rule: no more than a specified percentage of loss in a single day.It is particularly useful for proprietary trading firm challenges and for any trader seeking a strict daily stop after a series of losses.
The EA monitors the entire account, including trades across all symbols and those initiated by manual trading or other EAs. Importantly, the Daily Loss Limit Guard itself does not open any trades.
How It Works At the designated daily reset hour (according to the broker's server time), the EA records the current account balance as the day's starting balance.
Today's realized and unrealized loss is calculated as the difference between the day-start balance and the current account equity. This means open (floating) losses are included in the calculation.
When the accumulated loss reaches the defined limit, reduced by a small buffer (defaulting to 10% of the limit), the EA will close all open positions and delete all pending orders.
For the remainder of the day, the account is kept flat. Any new trade, whether opened manually or by another EA, will be immediately closed. This protection remains active until the next daily reset.
The day-start balance and the locked status are stored in the terminal's global variables, ensuring that this information is preserved even if the terminal is restarted.
Two status lines displayed on the chart provide real-time information, indicating whether the account is 'OK' or 'LOCKED', along with today's performance results, the loss limit, and the day-start balance.
Inputs InpLimitPct
(Default: 3.0) - The daily loss limit expressed as a percentage of the day-start balance.
InpLimitMoney
(Default: 0) - A fixed daily loss limit in the account's currency. If set to a value greater than 0, this value overrides the percentage limit.
InpResetHour
(Default: 0) - The hour of the day when the reset occurs, based on the broker's server time.
InpBufferPct
(Default: 10) - The percentage of the loss limit that triggers the protective actions in advance. This buffer provides room for potential slippage during trade closure.
InpAlert
(Default: true) - Enables a pop-up alert notification when the daily loss limit is reached.
Notes Attach this EA to only one chart and ensure that Algo Trading is enabled. The EA can only function while the MetaTrader terminal is running.
Proprietary trading firms may calculate daily losses differently. It is crucial to verify your specific firm's rules before relying solely on this EA.
The accompanying image serves as an illustration of the loss limit rule.
A more comprehensive tool, Prop Shield Drawdown Guard, is available on the Market. It offers features such as maximum loss limits (static or trailing), a daily profit lock, push notifications, and a detailed panel.
Last updated: 2026
You may also like: Daily Loss and Profit Lock for MT4/MT5 - excellent alternative for expert users on MetaTrader 5.
Source Code
#property copyright "RobotFX"
#property version "1.00"
#property description "This code is educational. Feel free to use, modify and upgrade as you wish. Visit ROBOTFX.ORG for professional trading tools"
input double InpLimitPct = 3.0;
input double InpLimitMoney = 0;
input int InpResetHour = 0;
input double InpBufferPct = 10.0;
input bool InpAlert = true;
#define PFX "DLLG_"
string g_gv;
.......
⚠ Limitations & Risk Warning
- This tool is provided for educational and testing purposes only.
- Past performance does not guarantee future results.
- Trading involves substantial risk of loss. Use on a demo account first.
- Results may vary depending on market conditions, broker, and settings.
- We recommend thorough backtesting and forward testing before using with real funds.