Expert Advisors • Indicators • Scripts • Libraries

MQL.RobotFX.org is the biggest collection of MetaTrader expert advisors (MT5 & MT4), indicators, scripts and libraries that can be used to improve trading results, minimize risks or simply automate trading tasks

Metatrader 5 Expert Advisor | PropGuard - account risk manager for prop firm accounts | Trading Tool Update

RobotFX curates the best open-source MetaTrader code to inspire your trading automation.

PropGuard watches the whole account, not one chart. Attach one copy to any chart and it checks every position on the account, whatever EA or magic number opened it, and closes everything when a prop firm style limit is reached.

What it enforces: a daily loss limit on equity including floating profit, with a reset at a server time you set; a maximum loss measured either from the initial balance or trailing from the equity peak; a lot cap per position; an optional trading window; an optional Friday close; and an optional blackout around high impact news from the MT5 economic calendar. After a breach it flattens the account, cancels pending orders and keeps closing anything new until the next daily reset, so another EA cannot trade you into a second breach on the same day.

Everything it does is written to the Experts log, to a CSV file in MQL5\Files named after the account login, and optionally sent as a push notification.

Trade the powerful Traders Dynamic Index strategy automatically with this dedicated TDI Expert Advisor. More details.

Symbol and timeframe do not matter, the guard works on the account. It runs on a timer as well as on ticks, so it keeps checking during quiet markets.

Inputs:
InpInitialBalance, the account size the firm's rules refer to.
InpDailyLossPct and InpMaxLossPct, the guard's own limits in percent. Set them a little below the firm's, for example 4 and 8 on an account with 5 and 10 percent rules, so you stop before the firm stops you.
InpMaxLossMode, static from the initial balance or trailing from the equity peak.
InpResetHour and InpResetMinute, the daily reset in server time.
InpMaxLotsPerPos, any position larger than this is closed.
InpCloseOnBreach and InpBlockAfterBreach, flatten on a breach and keep the account flat until the next reset.
InpUseWindow with start and end hour, InpFridayClose with its hour, both in server time.
InpUseNewsFilter, InpNewsCurrencies, InpNewsMinutesBefore and After, the calendar blackout.
InpPushAlerts, push notification on every action.
InpMagicToIgnore, positions with this magic number are left alone.

Tested on an FTMO trial account.

Image for PropGuard - account risk manager for prop firm accounts Image for PropGuard - account risk manager for prop firm accounts


Complement community code with advanced automation from RobotFX.

77710

Best MetaTrader Indicators + Profitable Expert Advisors