Equity guard for MetaTrader 5 that enforces a daily loss limit and a total drawdown limit, flattens the account on breach and blocks trading until the next daily reset. The expert opens no trades of its own: it is a protection layer that runs on a spare chart next to any strategy or manual trading.
This is the source published in the MQL5 Code Base: https://www.mql5.com/en/code/76767
| File | Role |
|---|---|
PropFirmGuard.mqh |
The CPropFirmGuard class: daily limit + total drawdown with safety buffer, flatten and block |
PropFirmGuardEA.mq5 |
Monitor expert (never trades): arms the guard and shows a status panel |
PropFirmGuardSelfTest.mq5 |
Test harness: bleeds the spread every bar until the daily limit is breached |
tester_guard.ini, tester_selftest.ini |
Headless strategy tester configs for both experts |
codebase_submission_en.md |
The Code Base description |
capturas/ |
Tester report charts used in the Code Base entry |
#include "PropFirmGuard.mqh"
CPropFirmGuard ExtGuard;
int OnInit(void)
{
// daily %, total drawdown %, buffer %, reset hour
if(!ExtGuard.Init(5.0, 10.0, 0.5, 0))
return(INIT_PARAMETERS_INCORRECT);
return(INIT_SUCCEEDED);
}
void OnTick(void)
{
ExtGuard.Update();
if(!ExtGuard.Allowed())
return;
// ... your trading logic here ...
}PropFirmGuard Pro adds verified prop firm presets (FTMO, FundedNext, Axi Select, The5ers), an on-chart panel with a pause button, a news pause based on the native economic calendar, a Friday close, an inactivity heartbeat, push notifications and an equity journal. It is sold on the MQL5 Market: https://www.mql5.com/en/market/product/193990
Copyright 2026, German Soto. Published in the MQL5 Code Base under its terms; you may use and modify the code in your own experts.