MT5 Prop Firm Guard is a reusable MQL5 include library for MetaTrader 5 that enforces prop-firm account rules, paired with a demonstration expert advisor using an H1 Donchian channel breakout strategy.
MT5 Prop Firm Guard monitors daily loss limits, static or trailing overall drawdown, profit targets, consistency limits, and maximum open risk, automatically closing positions and blocking new orders when thresholds or safety buffers are reached. Additional controls include daily trade caps, trading session hours, Friday cutoffs, and news event windows. The included EA is for demonstration only, and fast market gaps can still breach limits before execution.
Daily loss and static or trailing overall drawdown enforcement
Auto-flatten and order blocking with configurable safety buffer
Maximum open stop-loss risk and daily trade count limits
Trading session, Friday cutoff, and news window filters
Profit target auto-close and best-day consistency monitoring
Read from PropGuardDemoEA.mq5. Defaults are the author's; change them in the EA's Inputs tab.
Name
Type
Default
Description
InpInitialBalance
double
0
Initial balance (0 = current)
InpDailyLossPct
double
5.0
Max daily loss %
InpDailyFromEquity
bool
true
Daily reference uses max(balance,equity)
InpMaxDrawdownPct
double
10.0
Max overall drawdown %
InpDDMode
ENUM_PG_DD_MODE
PG_DD_STATIC
Drawdown mode
InpProfitTargetPct
double
8.0
Profit target %
InpStopAtTarget
bool
true
Flatten and stop at target
InpConsistencyPct
double
0
Best-day share limit % (0 = off)
InpMaxOpenRiskPct
double
2.0
Max open risk %
InpMaxTradesPerDay
int
5
Max trades per day (0 = off)
InpBufferPct
double
0.5
Safety buffer % before limits
InpStartHour
int
8
Trading start hour
Show all 24 inputs
Name
Type
Default
Description
InpEndHour
int
20
Trading end hour
InpBlockFriday
bool
true
Stop Friday afternoon
InpFridayCutoff
int
18
Friday cutoff hour
InpNews
string
News times "yyyy.mm.dd hh:mi;..."
InpNewsBefore
int
10
Minutes before news
InpNewsAfter
int
10
Minutes after news
InpFlattenNews
bool
false
Close positions in news window
InpTF
ENUM_TIMEFRAMES
PERIOD_H1
InpChannel
int
20
Donchian lookback bars
InpRiskPct
double
0.5
Risk per trade %
InpRR
double
2.0
Reward:risk
InpMagic
long
7701
Magic number
How to Install It
1Download the sourceUse "Download source (.zip)" above, or clone MT5-Automation-Labs/mt5-prop-firm-guard from GitHub, and unzip it.
2Open the data folderIn MetaTrader choose File, then Open Data Folder, and go to MQL5/Experts.
3Copy the filesCopy the .mq5 file into Experts, and any .mqh files into the Include folder the code expects.
4Compile in MetaEditorOpen the file in MetaEditor and press Compile. Fix any missing includes the compiler reports.
5Test before you tradeRun it in the Strategy Tester, then attach it to a demo chart and allow algorithmic trading.
Third-party code. ForexR did not write, test or endorse this EA, and the summary above was generated automatically from its README and code. ForexR lists only repositories with readable source code and never hosts files. Read the code, backtest it and use a demo account first; automated trading can lose money quickly.
Account Protector is a risk management expert advisor for MetaTrader 4 and 5 designed to monitor account health and prevent excessive drawdowns. It allows users to set specific triggers based on floating profit or loss, equity levels, free margin, spread, or daily performance. When these conditions are met, the EA auto
This expert advisor provides automated schedule management for the MetaTrader 4 and MetaTrader 5 platforms. It allows users to define specific time windows for each day of the week to toggle the platform's global AutoTrading status. Beyond simple scheduling, the utility can close active positions and delete pending ord
ICCapitals Secure is a risk management utility for MetaTrader 5. It acts as a supervisor to monitor and enforce trading parameters across an account. The expert advisor calculates position sizing based on a user-defined risk percentage per trade and manages risk-to-reward ratios. It features a timer-driven function to
Equity Protector is an account management utility for MetaTrader 5 designed to safeguard capital against significant drawdowns. It operates by monitoring account equity and balance at a user-defined frequency, such as every second. When the floating loss reaches a specified percentage or limit, the utility automaticall
Mask Protected Trading Panel is a manual execution utility for MetaTrader 5 designed to enforce discipline and strict risk management. It acts as a protective layer, blocking manual orders that violate pre-set rules such as maximum daily trades, drawdown limits, or minimum reward-to-risk ratios. The tool includes a man
Secure Risk Manager is a MetaTrader 5 utility designed to provide a framework for account protection and trade sizing. This expert advisor does not execute independent trade entries; rather, it functions as a risk control tool that calculates lot sizes based on a user-defined risk percentage and risk-to-reward ratios.