PropGuard
PropGuard is a free risk-guard Expert Advisor for MetaTrader 5, developed by MQLicense.com. It watches every position against nine prop-firm rules — daily loss limit, maximum drawdown, profit target, and more — and locks the account before a violation. Built for funded-account traders who cannot afford a rule breach.
Description
Account Protection & Prop-Firm Rule Enforcer for MetaTrader 5
Published by MQLicense.com — Free Risk Management Suite
1. Why PropGuard Exists
PropGuard is a free account-protection Expert Advisor for MetaTrader 5, developed by MQLicense.com. An Expert Advisor is a program that runs inside the MetaTrader 5 terminal. PropGuard is the third product in the MQLicense.com Risk Management Suite.
PropGuard exists to do one job: prevent your account from ever breaching a daily loss limit or a maximum drawdown. A drawdown is the distance from an equity peak to a later trough. PropGuard watches your equity in real time and warns you as you approach a limit.
When you actually cross a limit, the consequences are hard. PropGuard closes all protected positions, deletes pending orders, and locks the account until a configured condition releases it.
PropGuard was designed with two audiences in mind:
-
Prop-firm traders who must respect strict daily-loss and total-drawdown rules to keep their funded accounts.
-
Personal traders who want a mechanical, unemotional safety net for their own capital.
PropGuard does not open trades and does not generate signals. The tool is a guardian — it prevents damage and enforces discipline.
2. What PropGuard Is — and What It Is Not
PropGuard is a protection and enforcement tool, not a trading robot. The EA watches your account and acts only when a rule demands action.
The two lists below draw that line precisely. The first list shows what PropGuard does. The second shows what it deliberately never does.
Yes: What PropGuard is
-
A real-time monitor of your account equity.
-
An enforcer of daily loss and total drawdown limits.
-
A lock system that prevents new trades after a breach.
-
A risk-cap enforcer that can reject or close oversized positions.
-
A stop-loss requirement enforcer (no position without SL).
-
A weekend and hours guardian.
-
100% free, open-behavior, no license, no DLL, no telemetry.
No: What PropGuard is not
-
PropGuard does not open trades.
-
PropGuard does not provide entry signals.
-
PropGuard does not predict market direction.
-
PropGuard does not replace your trading strategy.
-
PropGuard does not guarantee profit.
-
PropGuard can not physically disable MT5's AutoTrading button (see Section 17).
3. How to Install PropGuard in MetaTrader 5
Installing PropGuard takes three steps: copy two files into the MQL5 folders, compile the Expert Advisor, and attach it to a chart. No DLL file is required at any step.
You need two files: a shared include library and the PropGuard source file. The table below shows exactly where each file goes.
Step 1 — Copy the Files
| File | Where to copy |
|---|---|
MQLicense_Common.mqh |
MQL5/Include/ |
PropGuard.mq5 |
MQL5/Experts/ |
Note:
MQLicense_Common.mqhis shared across the entire MQLicense.com suite. If you already have it installed (from LotSmith or TradeKeeper), do not overwrite it — the same file works for all five products.
Step 2 — Compile in MetaEditor (F7)
-
Open MetaEditor (press F4 in MT5).
-
Open
PropGuard.mq5from the Navigator. -
Press F7 (Compile).
-
Wait for: 0 errors, 0 warnings.
Step 3 — Attach PropGuard to a Chart
-
In MT5, open any chart (symbol doesn't matter — PropGuard protects the whole account).
-
Drag PropGuard from Navigator → Expert Advisors onto the chart.
-
Make sure the Algo Trading button is green.
-
Click OK in the Inputs dialog.
PropGuard is now monitoring your account. Rule enforcement starts from this moment forward.
Important: Run only ONE instance of PropGuard per account. Running multiple instances can cause conflicting actions.
4. First Launch and Recommended Settings
On first launch, the Inputs dialog appears. The defaults are tuned for a conservative personal trader (2% daily / 5% total).
If you're a prop-firm trader, choose the appropriate Rule Profile first and adjust from there.
Recommended first-time workflow:
-
Set InpProfile to
PG_CONSERVATIVE(default) for personal trading, orPG_CHALLENGE_STATICfor a prop challenge. -
Set InpDailyResetHour and InpDailyResetMin to match your broker's daily rollover time (usually 00:00 server time, but check your broker).
-
Set InpLockType to
PG_LOCK_DAY(default) so the lock automatically releases at the next daily reset. -
Click OK.
The panel appears. PropGuard is now live.
5. The Big Picture: The PropGuard Control Loop
Every 250 ms (and on every tick), PropGuard runs one control loop. The loop checks every protection rule in a fixed order.
The numbered steps below show the exact sequence. Each step either passes without action or triggers the response defined for that rule.
text
1. Is it a new day? → If yes, capture new day-start balance/equity, release day-lock if expired. 2. Update high-water mark (for trailing DD). 3. Is the account currently LOCKED? → If yes, close any new trades and delete any new pendings, then exit. 4. Evaluate daily loss → If breach, close all + lock. 5. Evaluate total drawdown → If breach, close all + lock. 6. Evaluate profit target → If reached, optionally close all + lock. 7. Check per-trade risk cap → Close or log oversized positions. 8. Check require-SL rule → Set default SL or close unprotected positions. 9. Check exposure limits → Warn on excess. 10. Check weekend / hours rules → Close positions if needed. 11. Update the panel.
The loop is idempotent — running it 10 times in a row produces the same result. PropGuard never "double acts" on the same position.
6. Rule Profiles: Choosing a Preset Rule Set
The InpProfile input lets you pick a pre-configured set of rules. In this release, the profile is a visual/behavioral preset. It does not overwrite your input values, but it aligns the panel display and recommends values.
The table below lists the five profiles shipped in this release. Pick the profile that matches your account type, then fine-tune the individual inputs.
| Profile | Daily Loss | Max DD | Mode | Best for |
|---|---|---|---|---|
| Custom | (your inputs) | (your inputs) | (your inputs) | Full manual control |
| Generic Challenge Static | 5% | 10% | Static | Typical prop challenges |
| Generic Challenge Trailing | 5% | 6% | Trailing | Stricter prop challenges |
| Generic Funded | 4% | 8% | Static | Funded-account operation |
| Conservative Personal | 2% | 5% | Static | Personal capital preservation |
Note: Real prop-firm names are intentionally not mentioned anywhere in the product. Use the generic profiles and adjust values to match your specific firm's rules.
7. Rule 1 — Daily Loss Limit: Your Maximum Loss per Trading Day
The daily loss limit is Rule 1 in PropGuard. The rule prevents your account from losing more than a set amount within a single trading day.
PropGuard captures a day-start reference, computes your daily P/L (profit and loss) against it, and triggers a breach when the limit is hit. The subsections below explain the calculation, the reference basis, and the day reset.
What Does the Daily Loss Limit Do?
The rule caps the total loss of one trading day. You define the cap in percent or in money, and a breach triggers the hard actions: close all + lock.
How PropGuard Calculates the Daily P/L
At day-start, PropGuard captures two reference values:
-
Start-of-day Balance (
g_dayStartBalance) -
Start-of-day Equity (
g_dayStartEquity)
Throughout the day, PropGuard computes the daily P/L against these values:
text
Daily P/L = Current Equity - Start-of-day Equity
The result includes floating P/L (the unrealized profit or loss of open positions), swap (overnight interest), and commission. All three affect your real equity.
Reference Basis: Balance, Equity, or the Higher of the Two
The InpDailyBasis input decides which value the loss limit is measured against. Three bases are available:
| Basis | Formula |
|---|---|
PG_BALANCE |
Limit = Start-of-day Balance × DailyLossPct |
PG_EQUITY |
Limit = Start-of-day Equity × DailyLossPct |
PG_HIGHER |
Limit = Max(Start-of-day Balance, Start-of-day Equity) × DailyLossPct |
PG_HIGHER (default) matches the most common prop-firm rule: "the higher of balance or equity at day start".
Day Reset Time: Matching Your Broker's Rollover
The trading day does not always start at midnight. Most brokers roll over at 00:00 server time, but some use a different schedule (e.g., 17:00 New York = 22:00 GMT).
Configure the reset time with two inputs:
-
InpDailyResetHour — e.g.,
0for midnight -
InpDailyResetMin — e.g.,
0for exactly midnight
PropGuard automatically handles the transition: when the reset time crosses, it captures a new day-start reference and (optionally) releases any day-lock.
Daily Loss Example: $10,000 Account
-
Account balance at day start: $10,000
-
Daily limit: 2%
-
Reference basis: Higher of balance/equity
-
Limit in money: $200
If your equity drops to $9,800 (a loss of $200), PropGuard triggers the breach → close all + lock.
8. Rule 2 — Maximum Total Drawdown: Static and Trailing Modes
The maximum total drawdown is Rule 2 in PropGuard. The rule limits how far your account can fall from a reference point, measured in percent.
PropGuard supports two modes: static (measured from the initial balance) and trailing (measured from the highest equity ever reached). The subsections below cover both modes and the supporting inputs.
What Does the Maximum Total Drawdown Do?
The rule prevents your account from losing more than a set amount (in %) from a reference point. That reference is usually the initial balance or the highest equity ever reached.
Two Modes: Static and Trailing
| Mode | Reference | When to use |
|---|---|---|
Static (PG_DD_STATIC) |
Initial balance | Classic funded-account rule. The DD is measured from the starting balance, forever. |
Trailing (PG_DD_TRAILING) |
High-water mark (HWM) | Strict prop-firm rule. The DD trails upward with your highest equity. |
Static measures from the starting balance, forever. Trailing measures from the high-water mark (HWM) — the highest equity your account has ever reached.
Static Example: $10,000 Account
-
Initial balance: $10,000
-
Max DD: 5% → limit = $500
-
If equity drops to $9,500 at any point → breach.
Trailing Example: High-Water Mark at $11,000
-
Initial balance: $10,000
-
Max DD: 5% (trailing from HWM)
-
Equity rises to $11,000 (HWM = $11,000)
-
Limit becomes $11,000 − 5% = $10,450
-
If equity drops to $10,450 → breach.
Auto-Detect Initial Balance (InpDDAutoBalance)
If you leave InpDDAutoBalance at 0, PropGuard captures the initial balance on the very first run (or the first run after state reset). This is the recommended approach for new accounts.
If you're attaching PropGuard mid-way through an account's life, you can hard-code the true initial balance in InpDDAutoBalance.
Trailing Stop-at-Initial Feature (InpDDTrailStopAt)
Some prop firms use a hybrid rule: "the trailing DD stops growing once equity reaches initial balance + X". Set InpDDTrailStopAt to X (in money). If X is $200, once equity reaches $10,200 the HWM freezes and no longer trails upward.
High-Water Mark (HWM) Persistence
The HWM is stored in a GlobalVariable. It survives:
-
Terminal restarts
-
Chart changes
-
Account switches
9. Rule 3 — Profit Target: Notify and Optionally Lock
The profit target is Rule 3 in PropGuard. When your account reaches a specified profit target, PropGuard notifies you.
Optionally, the rule can close all positions and lock the account to protect the achievement. The inputs below control both behaviors.
What Does the Profit Target Do?
The rule watches your equity against a target set as a percentage of the initial balance. Reaching the target fires a notification, and an optional close-all plus lock can follow.
Configuration Inputs and Defaults
| Input | Default | Behavior |
|---|---|---|
InpTargetOn |
false | Enable/disable |
InpTargetPct |
10.0 | Target as % of initial balance |
InpTargetCloseAll |
false | If true, closes all + locks when reached |
Profit Target Example: $10,000 Account
-
Initial balance: $10,000
-
Target: 10%
-
When equity reaches $11,000, PropGuard fires a notification.
-
If
InpTargetCloseAll = true, it also closes all positions and locks until next day.
The profit target rule is especially useful for funded-account traders who must stop after reaching a target to avoid giving back the profit.
10. Rule 4 — Soft Warnings: Alerts Before a Breach
Soft warnings are Rule 4 in PropGuard. They fire alerts when your usage of a limit crosses certain thresholds — before the actual breach.
PropGuard tracks the daily limit and the total limit and warns at each configured usage level. The inputs below control the levels and the alert channels.
What Do Soft Warnings Do?
Soft warnings measure how much of each limit you have already used. An alert fires when usage crosses a threshold, giving you time to react before the breach.
Configuration Inputs and Defaults
| Input | Default | Behavior |
|---|---|---|
InpWarnLevels |
"50,75,90" |
Comma-separated percentages |
InpWarnPopup |
false | Show a dialog box |
InpWarnSound |
true | Play a sound |
InpWarnPush |
false | Send a mobile push |
How the Warning Engine Works
For each limit (daily and total), PropGuard computes the percentage of the limit currently used. When usage crosses a configured threshold for the first time that day, the warning fires. PropGuard will not repeat the same warning until the next day.
Warning Example: $200 Daily Limit
-
Daily limit: $200
-
Warning levels: 50, 75, 90
-
Loss reaches $100 → alert "50%"
-
Loss reaches $150 → alert "75%"
-
Loss reaches $180 → alert "90%"
Hysteresis: No Repeat Warnings
Warnings have hysteresis: they don't re-fire when the metric bounces up and down around a threshold. Once a threshold is crossed, it's marked as "already warned" for that day.
11. Rule 5 — Hard Actions & Lock: What Happens After a Breach
Hard actions are Rule 5 in PropGuard. When a breach occurs, PropGuard takes hard actions — the "consequences" of crossing a limit.
The actions are configurable: close all protected positions, delete all protected pending orders, and lock the account for a chosen duration. The inputs below control each of them.
What Do Hard Actions Do?
A breach triggers the configured consequences immediately. PropGuard closes every protected position, deletes every protected pending order, and locks the account so no new trades survive.
Configuration Inputs and Defaults
| Input | Default | Behavior |
|---|---|---|
InpHardCloseAll |
true | Close all protected positions |
InpHardDeletePend |
true | Delete all protected pending orders |
InpLockType |
PG_LOCK_DAY |
How long the lock lasts |
InpPreemptBuffer |
5.0 | Trigger early by this % of the limit |
Pre-Emptive Buffer (InpPreemptBuffer)
The pre-emptive buffer triggers the breach before the limit is actually reached. The buffer protects against three failure modes:
-
Slippage on closing trades
-
Spread widening at the moment of breach
-
Small gaps between equity updates
With a 5% buffer on a $200 daily limit:
-
Actual limit: $200
-
Effective trigger: $190 (95% of $200)
Lock Durations: None, Day, Week, or Manual
| Type | Behavior |
|---|---|
PG_LOCK_NONE |
No lock. Only close-all + delete-pendings. |
PG_LOCK_DAY |
Locked until the next daily reset. Recommended default. |
PG_LOCK_WEEK |
Locked for 7 days. |
PG_LOCK_MANUAL |
Locked forever until the user manually unlocks via the panel button. |
How the Lock Is Enforced
PropGuard cannot physically disable the AutoTrading button in MT5 — no EA can. Instead, it enforces the lock through three channels:
-
OnTick / OnTimer (250 ms): continuously closes any new positions and deletes any new pending orders.
-
OnTradeTransaction: reacts instantly when a new position or pending order is opened, and closes/deletes it within ~1 second.
-
GlobalVariable flag: other MQLicense.com products (LotSmith, TradeKeeper) read this flag and refuse to open new trades while it's set.
The panel shows a red LOCKED banner with the reason and the exact release time.
12. Rule 6 — Per-Trade Risk Cap: Limit the Risk of Any Single Position
The per-trade risk cap is Rule 6 in PropGuard. The rule targets risk-at-SL — the exact loss a position would suffer if its stop loss is hit.
If that loss exceeds a maximum percentage of your balance, PropGuard rejects or closes the position. The subsections below explain the calculation, an example, and the best use cases.
What Does the Per-Trade Risk Cap Do?
The rule rejects or closes any single position whose risk-at-SL exceeds a maximum percentage of your balance. The maximum is defined per trade, so one oversized trade cannot sink the day.
Configuration Inputs and Defaults
| Input | Default | Behavior |
|---|---|---|
InpRiskCapOn |
false | Enable/disable |
InpRiskCapPct |
1.0 | Max risk per trade (% of balance) |
InpRiskAction |
PG_ACTION_CLOSE |
Close the position, or just log a warning |
How PropGuard Calculates Risk per Position
For each protected position with an SL:
text
Risk = |Loss at SL| computed via OrderCalcProfit
The result is the exact loss in account currency if the SL is hit, not a rough estimate. The computation uses OrderCalcProfit, the built-in MetaTrader 5 calculation engine.
Per-Trade Risk Example: $10,000 Account
-
Balance: $10,000
-
Cap: 1% → $100
-
A position with 2 lots of EURUSD and a 100-point SL has a risk of ~$200
-
Since $200 > $100, PropGuard either closes it or logs it (per
InpRiskAction)
When to Use the Per-Trade Risk Cap
-
Prop firms with per-trade risk rules.
-
Risk-averse traders who want to prevent a single bad trade from blowing their day.
-
Combined with LotSmith: LotSmith calculates the correct lot size, PropGuard enforces the cap as a safety net.
13. Rule 7 — Require Stop Loss: Every Position Needs an SL
Require Stop Loss is Rule 7 in PropGuard. The rule guarantees that every protected position carries a stop loss (SL).
A stop loss is a pre-set exit that caps the loss on a position. If an SL is missing after the grace period, PropGuard sets a default or closes the trade.
What Does the Require Stop Loss Rule Do?
The rule ensures every protected position has a stop loss within a grace period. PropGuard checks each new position and starts the grace countdown as soon as it opens.
Configuration Inputs and Defaults
| Input | Default | Behavior |
|---|---|---|
InpRequireSL |
false | Enable/disable |
InpSLGraceSec |
30 | Grace period after the position opens |
InpSLSetDefault |
true | If true: set default SL. If false: close the position. |
InpSLDefaultPoints |
300 | Default SL distance in points |
Grace Period: Time to Set Your Own SL
The grace period exists so you have time to set your own SL after opening a trade. If you set your own SL within 30 seconds, PropGuard does nothing.
If you haven't set one by the deadline:
-
With
InpSLSetDefault = true: PropGuard applies a default SL 300 points away. -
With
InpSLSetDefault = false: PropGuard closes the position.
Best Practice for Prop-Firm Traders
For prop firms that require SL on every trade, set InpRequireSL = true and InpSLSetDefault = true with a wide default (e.g., 500 points). The wide SL acts as a catastrophic backstop and does not interfere with your normal trading.
14. Rule 8 — Exposure Limits
Rule 8 is PropGuard's exposure guard. It caps position count, total lots, and new trades per day.
All four limits are warning-based: PropGuard alerts you when a ceiling is crossed. The table below lists each input with its default value and behavior.
What the Exposure Limits Track
Rule 8 tracks the number of open positions, the total lots across them, and the number of new trades per day. PropGuard warns when any of the three exceeds its input limit.
Exposure Limit Inputs
| Input | Default | Behavior |
|---|---|---|
InpMaxPositions |
10 | Maximum open positions |
InpMaxTotalLots |
5.0 | Maximum total lots across all positions |
InpMaxLotPerTrade |
1.0 | Maximum lots per single trade |
InpMaxTradesDay |
20 | Maximum new trades per day |
How Exposure-Limit Enforcement Works
Exposure limits are warning-based in this release. PropGuard notifies you when you exceed a limit, but it does not automatically close positions to comply.
For strict enforcement, use LotSmith's safety limits or the per-trade risk cap in PropGuard. These options add hard limits on top of the Rule 8 warnings.
15. Rule 9 — Time Filters
Rule 9 controls when PropGuard allows trading by time. It combines a Friday close that prevents weekend gap risk with optional allowed-hour windows.
Weekend protection and allowed hours both ship disabled by default. Enable them through the inputs shown in the two tables below.
Weekend Protection: the Friday Close
| Input | Default | Behavior |
|---|---|---|
InpNoWeekendHold |
false | Enable/disable |
InpFriCloseHour |
20 | Hour (server time) |
InpFriCloseMin |
0 | Minute |
When you enable InpNoWeekendHold, PropGuard closes all protected positions on Friday at the specified time. This prevents weekend gap risk.
Allowed Trading Hours
| Input | Default | Behavior |
|---|---|---|
InpAllowedHoursOn |
false | Enable/disable |
InpAllowedHours |
"0-24" |
Allowed windows |
The InpAllowedHours string accepts "8-20" for 8 AM to 8 PM, or "8-12,14-20" for two separate windows. PropGuard applies the windows when InpAllowedHoursOn is enabled.
Outside allowed hours, PropGuard will not close existing positions unless the weekend rule fires. Instead, it blocks new entries by raising the lock flag described in section 17.
16. Position & Magic Filters
The position and magic filters decide which trades PropGuard protects. Out of the box, PropGuard protects every position and order on the account.
The whole-account default suits prop-firm accounts, which trade a firm's capital under strict risk rules. Use the filter inputs only for selective coverage.
What the Position & Magic Filters Do
The filters decide which positions and orders PropGuard protects. Coverage can span the whole account or a selected subset of Expert Advisors (EAs) and symbols.
Filter Inputs and Defaults
| Input | Default | Behavior |
|---|---|---|
InpProtectWholeAcc |
true | If true, all positions/orders are protected regardless of filters |
InpFilterMode |
PG_FILTER_ALL |
All / Magic / Symbol |
InpFilterMagicList |
"" | Comma-separated magic numbers |
InpFilterSymbolList |
"" | Comma-separated symbols |
Recommended Filter Settings for Prop Firms
For prop-firm use, keep InpProtectWholeAcc = true. PropGuard then watches every position, no matter which EA or manual action opened it.
In advanced setups, set InpProtectWholeAcc = false to protect only certain positions, such as one specific strategy. Then configure InpFilterMode together with the magic-number or symbol list.
17. The Lock System — Deep Dive
The Lock System is the enforcement core of PropGuard. When a rule is breached, PropGuard locks the account and closes any new trade that appears.
The subsections below explain why the soft lock exists, how fast it reacts, and how the suite reads its flag.
Why PropGuard Uses a Soft Lock
Prop firms require traders to stop trading immediately after a limit is breached. An EA, however, cannot click MT5's AutoTrading button or disable trading at the platform level. It also cannot prevent you from opening a trade manually.
PropGuard therefore implements a soft lock:
-
The lock is an internal state, persisted in MT5 GlobalVariables.
-
While the lock is active, PropGuard closes any new position that appears.
-
While the lock is active, PropGuard deletes any new pending order that appears.
-
While the lock is active, PropGuard publishes a GlobalVariable that other MQLicense.com EAs read.
Why the Soft Lock Works in Practice
The lock reaction time is ~250 ms in normal markets, thanks to the fast internal timer. If a rogue EA or an accidental click opens a new trade, PropGuard closes it almost immediately.
The only positions that survive are those opened before the lock started. The trader may still legitimately need to close them. Brokers always allow close-only actions, even when they report "trading disabled".
The GlobalVariable the Lock Publishes
When the lock is active:
The published GlobalVariable reads:
MQLic_PropGuard_<login>_LOCK = 1
When the lock releases:
The same GlobalVariable returns to 0:
MQLic_PropGuard_<login>_LOCK = 0
Other products in the suite, such as LotSmith and TradeKeeper, read this flag when InpRespectSuite = true. While the flag is set, they refuse to open new trades.
Manual Unlock With the Panel Button
For PG_LOCK_MANUAL, the Unlock button on the panel becomes active. The button requires a confirmation dialog, so use it with care.
For all other lock types, the Unlock button stays intentionally disabled. The lock releases itself at the appropriate time.
18. Suite Integration — How PropGuard Works With the Other EAs
PropGuard is designed to work alongside the entire MQLicense.com suite. The table below shows how each product reacts to the LOCK flag.
Only PropGuard publishes the LOCK flag, and only suite products read it. TradeGate keeps its own independent BLOCK flag.
| Product | Interaction |
|---|---|
| LotSmith | Reads the LOCK flag; refuses to open new trades while locked. |
| TradeKeeper | Reads the LOCK flag; continues protective actions (breakeven, trailing) but blocks new entries. |
| RiskRadar | Purely informational — no interaction. |
| TradeGate | Independent — has its own BLOCK flag. |
Recommended Order to Run the Suite
For best protection, run PropGuard before or alongside the other products. The list below shows the recommended stacking order:
-
PropGuard (protects the account)
-
TradeGate (filters bad market conditions)
-
LotSmith (opens trades)
-
TradeKeeper (manages open positions)
-
RiskRadar (informational dashboard)
All 5 products can run simultaneously on the same account.
19. The Panel — Layout, Status Colors, and Buttons
The PropGuard panel puts every protected metric on one chart overlay. Equity, daily P/L, drawdown usage, target progress, and open positions all appear as live rows.
The subsections below cover the layout, the four status colors, the KPI rows, and the panel buttons.
Panel Layout
The panel occupies one corner of the chart and looks like this:
┌──────────────────────────────────────────────────────┐ │ PropGuard | MQLicense.com [_] │ ├──────────────────────────────────────────────────────┤ │ Status: ACTIVE │ │ Equity: 10,142.50 │ │ Balance: 10,000.00 │ │ Daily P/L: +142.50 │ │ Daily remaining: 200.00 │ │ Total DD used: 0.00 / 500.00 │ │ DD remaining: 500.00 │ │ Target progress: 14.3% │ │ Positions: 2 │ │ Open lots: 0.30 │ │ Floating: +142.50 │ │ Trading days: 3 │ │ │ │ [ Close All Now ] [ Unlock ] │ │ [ Reset Daily ] [ Rules ] │ │ │ │ MQLicense.com │ └──────────────────────────────────────────────────────┘
Status Line Colors
The status line color-codes the current state. Four states exist, and each uses its own color:
| Status | Meaning | Color |
|---|---|---|
| ACTIVE | Everything is fine | Green |
| CAUTION | One of the limits is above 50% used | Yellow |
| WARNING: near breach | One of the limits is above 90% used | Orange |
| LOCKED | A breach has occurred; the account is locked | Red |
KPI Rows and What They Show
Every KPI (key performance indicator) row updates in real time. The list below explains what each row means:
-
Equity / Balance — current account values.
-
Daily P/L — today's P/L, colored green (positive) or red (negative).
-
Daily remaining — how much more you can lose today before breach.
-
Total DD used / DD remaining — current drawdown and remaining allowance.
-
Target progress — percentage toward your profit target.
-
Positions / Open lots / Floating — current exposure snapshot.
-
Trading days — number of days with at least one closed trade.
Panel Buttons and Their Actions
| Button | Action |
|---|---|
| Close All Now | Immediately closes all protected positions. Requires confirmation. |
| Unlock | Only active if InpLockType = PG_LOCK_MANUAL. Releases the lock after confirmation. |
| Reset Daily | Resets the daily reference (day-start balance/equity) to current values. Use with care. |
| Rules | Shows a popup with the currently active rules for review. |
Minimize the Panel
Click _ to minimize the panel to a small chart comment. The comment shows the current status. Click again to restore the full panel.
20. GlobalVariables & Persistence
PropGuard stores all of its critical state in MT5 GlobalVariables. Because of that storage, the state survives terminal restarts, chart changes, and symbol changes.
Every key is prefixed with MQLic_PropGuard_<login>_, so each trading account keeps its own separate state. The table below lists all stored keys and their purposes.
Stored GlobalVariable Keys
| Key | Purpose |
|---|---|
MQLic_PropGuard_<login>_day_start |
Timestamp of the current day's start |
MQLic_PropGuard_<login>_day_start_bal |
Balance at day start |
MQLic_PropGuard_<login>_day_start_eq |
Equity at day start |
MQLic_PropGuard_<login>_hwm |
High-water mark of equity |
MQLic_PropGuard_<login>_init_bal |
Initial balance |
MQLic_PropGuard_<login>_lock_until |
Lock expiry timestamp |
MQLic_PropGuard_<login>_trading_days |
Count of trading days |
MQLic_PropGuard_<login>_LOCK |
Published flag (1 = locked) |
The 4-Week Expiry Rule
MT5 GlobalVariables expire after 4 weeks of no access. PropGuard touches them on every tick and every timer cycle. In practice, they never expire as long as PropGuard is running.
Exception: if you shut down MT5 for more than 4 weeks while holding open positions and a lock, the state may be lost. On the next restart, PropGuard will treat the account as freshly started and re-detect the initial balance.
Account Switches and Per-Account State
GlobalVariables are per-account in MT5. Switching accounts therefore gives PropGuard a clean slate, which is exactly what you want.
How to Reset PropGuard's State
You can fully reset PropGuard's state and start over at any time. Follow these four steps:
-
Detach PropGuard from the chart.
-
Open MetaTrader's Global Variables window (F3).
-
Delete all variables starting with
MQLic_PropGuard_<your login>_. -
Reattach PropGuard.
21. Common Scenarios — Ready-Made Input Configurations
PropGuard supports many configurations, and this section shows five common ones. Each scenario lists the exact inputs to set and the result you should expect.
Scenarios 1 and 2 mirror typical challenge and funded-account rules. Scenarios 3 to 5 cover personal accounts and special purposes.
Scenario 1 — Generic prop challenge, 5% daily / 10% static
The configuration uses these inputs:
-
InpProfile = PG_CHALLENGE_STATIC -
InpDailyLossPct = 5.0 -
InpTotalDDPct = 10.0 -
InpDDMode = PG_DD_STATIC -
InpLockType = PG_LOCK_DAY -
InpPreemptBuffer = 5.0
Result: PropGuard protects the challenge limits and stops trading for the day if you hit a 5% loss.
Scenario 2 — Funded account, tight trailing DD
The configuration uses these inputs:
-
InpProfile = PG_CHALLENGE_TRAILING -
InpDailyLossPct = 4.0 -
InpTotalDDPct = 6.0 -
InpDDMode = PG_DD_TRAILING -
InpDDTrailStopAt = 200.0
Result: the drawdown trails your profits, but it stops growing once you have made $200 above the initial balance.
Scenario 3 — Conservative personal account
The configuration uses these inputs:
-
InpProfile = PG_CONSERVATIVE -
InpDailyLossPct = 2.0 -
InpTotalDDPct = 5.0 -
InpRequireSL = true -
InpSLSetDefault = true -
InpSLDefaultPoints = 500
Result: soft protection with a default stop-loss (SL) backstop on every trade.
Scenario 4 — Enforcement only (no daily reset)
The configuration uses these inputs:
-
InpDailyOn = false -
InpTotalDDOn = true -
InpTotalDDPct = 15.0 -
InpLockType = PG_LOCK_MANUAL
Result: only the total drawdown (DD) limit is enforced. When it is breached, the account locks until you unlock it manually.
Scenario 5 — Weekend protection only
The configuration uses these inputs:
-
InpNoWeekendHold = true -
InpFriCloseHour = 20 -
InpFriCloseMin = 0 -
All other limits: disabled
Result: PropGuard closes all positions every Friday at 20:00 server time.
22. Troubleshooting — Common Problems and Fixes
Most PropGuard problems trace back to a small set of causes. Each symptom below lists the likely causes first and the fix second.
The panel status names the active state, which narrows the likely cause immediately.
The panel shows "LOCKED" but I didn't breach anything
Check these possible causes:
-
A
MQLic_PropGuard_<login>_LOCKGlobalVariable (GV) was set manually or by another program. -
The lock timestamp is in the future due to a system clock change.
-
A
PG_LOCK_MANUALlock was applied earlier and not unlocked.
Fix: check the reason in the panel. If the lock is PG_LOCK_MANUAL, use the Unlock button. Otherwise, wait for the lock to expire or reset the GVs.
Positions aren't being closed on breach
Check these possible causes:
-
The market is closed → broker rejects close orders. PropGuard retries on the next cycle.
-
The positions don't match the current filter.
-
InpHardCloseAllisfalse.
Fix: verify the filter settings and InpHardCloseAll.
My daily reference keeps resetting
Check these possible causes:
-
The reset hour is set to the current server hour → every tick that crosses the boundary resets.
-
Daylight saving time shift.
Fix: set InpDailyResetHour and InpDailyResetMin to a quiet time, such as 00:00 or 23:55.
The lock isn't blocking my other EA
Only MQLicense.com products honor the LOCK GV. EAs from other developers do not read the flag, so they will not respect the lock. For those EAs, PropGuard's position-closing enforcement still applies within ~250 ms.
Deposits or withdrawals falsely trigger breach
Deposits and withdrawals can falsely trigger a breach in this version. Fix: after a deposit or withdrawal, click Reset Daily manually and, if needed, update the initial balance in the inputs.
PropGuard reacts slowly on a quiet symbol
The internal timer runs at 250 ms regardless of symbol ticks, so reaction time stays consistent. On a symbol with very few ticks, panel updates may look slow, but enforcement still runs.
23. Best Practices for Running PropGuard
PropGuard works best when it is configured deliberately. The eight practices below cover placement, reset timing, lock choice, and testing.
Practices 5 and 8 also pair PropGuard with LotSmith and TradeGate for a complete protection layer.
1. Run exactly one instance
Multiple PropGuard instances on the same account will conflict. Attach PropGuard once, ideally on a low-timeframe chart of a frequently ticking symbol such as EURUSD M1.
2. Set the daily reset time correctly
Ask your broker for their daily rollover time. If you are unsure, use 00:00 server time.
3. Use PG_LOCK_DAY
PG_LOCK_DAY is the friendliest default: it locks the account for one day and then auto-releases. Use PG_LOCK_MANUAL only if you truly want a permanent lockdown until manual intervention.
4. Keep the pre-emptive buffer at 5%
A 5% buffer protects against small slippage without triggering the lock too early.
5. Combine with LotSmith
Let LotSmith calculate the correct lot size for every trade. Let PropGuard act as the hard stop if anything goes wrong. The combination is ideal for a disciplined trader.
6. Test on demo for 1 week
PropGuard is free and safe, yet always test it on a demo account for at least one week first. Confirm that the reset time and the limit behavior match your expectations.
7. Back up your GlobalVariables
Before major changes, note the current GV values (press F3 in MT5). The notes let you restore the values if needed.
8. Combine with TradeGate for news protection
TradeGate from the same suite blocks trading around high-impact news. Together, PropGuard and TradeGate form a complete protection layer.
24. Limitations of PropGuard
PropGuard has clear limits, and knowing them prevents false expectations. No Expert Advisor can control every part of the MetaTrader 5 terminal.
Each entry below states the limit and what PropGuard does instead. Read them before relying on the lock with real money.
It cannot disable MT5's AutoTrading button
No Expert Advisor can disable MT5's AutoTrading button. The PropGuard lock is a state that closes new trades and deletes new pending orders. The AutoTrading button therefore remains green.
It cannot prevent manual trades opened during the lock
PropGuard can only close such trades after they open, within ~250 ms. The trader typically sees the position flash open and closed. A fraction of a second always passes while the trade is live.
It cannot protect against external withdrawals
If you withdraw money from the account, PropGuard may treat the withdrawal as a loss. Use Reset Daily manually after every withdrawal.
It does not manage pending-order expiry
On a breach, PropGuard only enforces deletion of pending orders. Expiration dates remain the broker's domain.
Enforcement relies on the market being open
If a breach occurs while the market is closed, PropGuard cannot close positions until the market reopens. It retries continuously in the meantime.
The PG_LOCK_WEEK and PG_LOCK_MANUAL locks persist across account switches
The lock stays with the account because GlobalVariables are per-account. Switching to a different account gives you a fresh state.
No deposit/withdrawal awareness in this version
Deposits and withdrawals can falsely trigger a breach in this version. A future version will auto-detect balance deals and adjust the references accordingly.
Rule profiles are visual only in this version
The profile input does not overwrite your input values. It only aligns the panel display and recommends values. A future version will make profiles fully functional.
No consistency-rule enforcement
Some prop firms apply a "consistency rule" that compares the largest winning day with total profit. PropGuard does not enforce this rule in the current version.
25. Input Reference — Complete Table
This reference lists all 54 PropGuard inputs with type, default, and description. Use it to audit your settings before you attach PropGuard to a challenge.
Bold group rows mark each rule family, from the rule profile down to the license key. The Default column shows the value PropGuard uses out of the box.
| # | Input | Type | Default | Description |
|---|---|---|---|---|
| Rule Profile | ||||
| 1 | InpProfile |
enum | PG_CONSERVATIVE |
Active rule profile (visual only in this version) |
| Daily Loss Limit | ||||
| 2 | InpDailyOn |
bool | true |
Enable daily loss protection |
| 3 | InpDailyLossPct |
double | 2.0 |
Daily loss limit as % of reference |
| 4 | InpDailyUseMoney |
bool | false |
Use money instead of % |
| 5 | InpDailyLossMoney |
double | 200.0 |
Daily loss limit in account currency |
| 6 | InpDailyBasis |
enum | PG_HIGHER |
Reference basis: Balance / Equity / Higher |
| 7 | InpDailyResetHour |
int | 0 |
Server hour when the day resets |
| 8 | InpDailyResetMin |
int | 0 |
Server minute when the day resets |
| Total Drawdown | ||||
| 9 | InpTotalDDOn |
bool | true |
Enable max total drawdown protection |
| 10 | InpTotalDDPct |
double | 5.0 |
Max total drawdown as % |
| 11 | InpDDMode |
enum | PG_DD_STATIC |
Static or Trailing DD |
| 12 | InpDDAutoBalance |
double | 0.0 |
Initial balance (0 = auto detect) |
| 13 | InpDDTrailStopAt |
double | 0.0 |
Trailing stops when equity reaches initial + X (money) |
| Profit Target | ||||
| 14 | InpTargetOn |
bool | false |
Enable profit target |
| 15 | InpTargetPct |
double | 10.0 |
Target as % of initial balance |
| 16 | InpTargetCloseAll |
bool | false |
Close all + lock when target reached |
| Soft Warnings | ||||
| 17 | InpWarnLevels |
string | "50,75,90" |
Warning thresholds (% of limit) |
| 18 | InpWarnPopup |
bool | false |
Show popup on warning |
| 19 | InpWarnSound |
bool | true |
Play sound on warning |
| 20 | InpWarnPush |
bool | false |
Send push notification on warning |
| Hard Actions | ||||
| 21 | InpHardCloseAll |
bool | true |
Close all on breach |
| 22 | InpHardDeletePend |
bool | true |
Delete pendings on breach |
| 23 | InpLockType |
enum | PG_LOCK_DAY |
Lock duration: None / Day / Week / Manual |
| 24 | InpPreemptBuffer |
double | 5.0 |
Pre-emptive buffer (% of limit) |
| Per-Trade Risk | ||||
| 25 | InpRiskCapOn |
bool | false |
Enforce max risk per trade |
| 26 | InpRiskCapPct |
double | 1.0 |
Max risk per trade (% of balance) |
| 27 | InpRiskAction |
enum | PG_ACTION_CLOSE |
Close or log oversized positions |
| Require Stop Loss | ||||
| 28 | InpRequireSL |
bool | false |
Require SL on every position |
| 29 | InpSLGraceSec |
int | 30 |
Grace period (seconds) |
| 30 | InpSLSetDefault |
bool | true |
Set default SL (else close position) |
| 31 | InpSLDefaultPoints |
double | 300.0 |
Default SL distance (points) |
| Exposure Limits | ||||
| 32 | InpMaxPositions |
int | 10 |
Max open positions |
| 33 | InpMaxTotalLots |
double | 5.0 |
Max total lots |
| 34 | InpMaxLotPerTrade |
double | 1.0 |
Max lots per single trade |
| 35 | InpMaxTradesDay |
int | 20 |
Max new trades per day |
| Time Filters | ||||
| 36 | InpNoWeekendHold |
bool | false |
Close positions before the weekend |
| 37 | InpFriCloseHour |
int | 20 |
Friday close hour (server time) |
| 38 | InpFriCloseMin |
int | 0 |
Friday close minute |
| 39 | InpAllowedHoursOn |
bool | false |
Restrict allowed trading hours |
| 40 | InpAllowedHours |
string | "0-24" |
Allowed windows (e.g. 8-20 or 8-12,14-20) |
| Position Filters | ||||
| 41 | InpFilterMode |
enum | PG_FILTER_ALL |
All / Magic / Symbol |
| 42 | InpFilterMagicList |
string | "" |
Comma-separated magic numbers |
| 43 | InpFilterSymbolList |
string | "" |
Comma-separated symbols |
| 44 | InpProtectWholeAcc |
bool | true |
Protect everything, ignoring filters |
| Execution | ||||
| 45 | InpDeviation |
int | 20 |
Maximum slippage for closes (points) |
| Panel & Theme | ||||
| 46 | InpShowPanel |
bool | true |
Show the panel |
| 47 | InpTheme |
enum | MQL_THEME_DARK |
Light or dark theme |
| 48 | InpPanelX |
int | 20 |
Panel X position (pixels from corner) |
| 49 | InpPanelY |
int | 30 |
Panel Y position (pixels from corner) |
| Notifications | ||||
| 50 | InpNotifyPopup |
bool | true |
Popup alerts |
| 51 | InpNotifySound |
bool | true |
Sound alerts |
| 52 | InpNotifyPush |
bool | false |
Push notifications to mobile |
| 53 | InpNotifyEmail |
bool | false |
Email alerts |
| License | ||||
| 54 | InpLicenseKey |
string | placeholder | License key issued by MQLicense.com |
26. Disclaimer
PropGuard is a protection tool, and the disclaimer blockquote below applies to every configuration. Read it before attaching the EA to a live account.
The checklist after the disclaimer summarizes the pre-live checks in one place.
Trading involves substantial risk. PropGuard is provided free of charge, as-is, and without any warranty. Test on a demo account first. MQLicense.com is not responsible for any losses.
PropGuard is a protective tool, and it stays inside that role. It does not generate signals, does not predict market direction, and does not guarantee that your account will never breach a limit. The EA executes the rules you configure — no more, no less. The quality of those rules, and of the trades they protect, remains entirely your responsibility.
Complete these checks before using PropGuard on a live account:
-
Test it on a demo account for at least one week.
-
Confirm that the daily reset time matches your broker.
-
Confirm that the lock behavior matches your expectations.
-
Understand the difference between Static and Trailing drawdown.
-
Read the panel after each significant price move to verify the correct status.
-
Never risk money you cannot afford to lose.
End of Guide — PropGuard | MQLicense.com
For updates, additional products, and the rest of the risk-management suite, visit MQLicense.com.
Frequently Asked Questions
Is PropGuard free to use? +
Does PropGuard place trades? +
Which prop-firm rules does PropGuard cover? +
What happens when a rule is breached (the Lock)? +
Can PropGuard run alongside other Expert Advisors? +
Does PropGuard work on MT4 or MT5? +
Reviews 0
Be the first to share your experience!
Write a Review
🔐 Login to write a review and share your experience.
Login