Risk & protection · MT4 · MT5

Account Protector

by EarnForex

Account Protector is a risk management expert advisor for MetaTrader 4 and 5 designed to monitor account health and prevent excessive drawdowns.

GitHub stars124
Forks61
Last update7 months ago19 Feb 2026
LicenceApache-2.0
Latest release1.147 months ago

Overview

Account Protector 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 automatically executes actions such as closing active trades, deleting pending orders, or disabling automated trading. The tool features an emergency button for manual liquidation and supports trade management functions like trailing stops and break-even adjustments via an on-chart panel.

Details

Author

EarnForex on GitHub

Type

Risk & protection

Platform

MetaTrader 4 (MQL4) and MetaTrader 5 (MQL5)

Markets

Any symbol

Timeframes

Any timeframe

Risk profile

No grid, martingale or hedging logic was found in its code or README. That says nothing about how it performs: backtest it first.

Topics

expert-advisorpositionchartmql5mql4mt4mt5tradingmetatradermetatrader-4

Input parameters

Read from Account Protector.mq5. Defaults are the author's; change them in the EA's Inputs tab.

NameTypeDefaultDescription
EnableEmergencyButtonboolfalseEnable emergency button
DoNotDisableConditionsboolfalseDoNotDisableConditions: Don't disable conditions on trigger?
DoNotDisableActionsboolfalseDoNotDisableActions: Don't disable actions on trigger?
DoNotDisableEquityTSboolfalseDoNotDisableEquityTS: Don't disable equity TS on trigger?
DoNotDisableTimerboolfalseDoNotDisableTimer: Don't disable timer on trigger?
ConditionDelayint0ConditionDelay: How long should condition be active to trigger?
CountFloatingInDailyPLbooltrueCountFloatingInDailyPL: Count floating P/L in daily P/L?
EnableAutoSwitchOnPeriodboolfalseEnable auto switch ON period
DisableFloatLossRisePercboolfalseDisable floating loss rises % condition.
DisableFloatLossFallPercbooltrueDisable floating loss falls % condition.
DisableFloatLossRiseCurrboolfalseDisable floating loss rises currency units condition.
DisableFloatLossFallCurrbooltrueDisable floating loss falls currency units condition.
Show all 40 inputs
NameTypeDefaultDescription
DisableFloatLossRisePointsboolfalseDisable floating loss rises points condition.
DisableFloatLossFallPointsbooltrueDisable floating loss falls points condition.
DisableFloatProfitRisePercboolfalseDisable floating profit rises % condition.
DisableFloatProfitFallPercbooltrueDisable floating profit falls % condition.
DisableFloatProfitRiseCurrboolfalseDisable floating profit rises currency units condition.
DisableFloatProfitFallCurrbooltrueDisable floating profit falls currency units condition.
DisableFloatProfitRisePointsboolfalseDisable floating profit rises points condition.
DisableFloatProfitFallPointsbooltrueDisable floating profit falls points condition.
DisableCurrentPriceGEbooltrueDisable current price greater or equal condition.
DisableCurrentPriceLEbooltrueDisable current price less or equal condition.
DisableEquityUnitsLEboolfalseDisable equity less or equal currency units condition.
DisableEquityUnitsGEboolfalseDisable equity greater or equal currency units condition.
DisableEquityPercLEboolfalseDisable equity less or equal % of snapshot condition.
DisableEquityPercGEboolfalseDisable equity greater or equal % of snapshot condition.
DisableEquityMinusSnapshotbooltrueDisable (Equity - snapshot) greater or equal condition.
DisableSnapshotMinusEquitybooltrueDisable (snapshot - Equity) greater or equal condition.
DisableMarginUnitsLEboolfalseDisable free margin less or equal currency units condition.
DisableMarginUnitsGEboolfalseDisable free margin greater or equal currency units condition.
DisableMarginPercLEboolfalseDisable free margin less or equal % of snapshot condition.
DisableMarginPercGEboolfalseDisable free margin greater or equal % of snapshot condition.
DisableMarginLevelGEbooltrueDisable margin level greater or equal condition.
DisableMarginLevelLEbooltrueDisable margin level less or equal condition.
DisableSpreadGEbooltrueDisable spread greater or equal condition.
DisableSpreadLEbooltrueDisable spread less or equal condition.
DisableDailyProfitLossUnitsGEbooltrueDisable daily profit/loss greater or equal units condition.
DisableDailyProfitLossUnitsLEbooltrueDisable daily profit/loss less or equal units condition.
DisableDailyProfitLossPointsGEbooltrueDisable daily profit/loss greater or equal points condition.
DisableDailyProfitLossPointsLEbooltrueDisable daily profit/loss less or equal points condition.

How to install it

  1. 1Download the sourceUse "Download source (.zip)" above, or clone EarnForex/Account-Protector from GitHub, and unzip it.
  2. 2Open the data folderIn MetaTrader choose File, then Open Data Folder, and go to MQL4/Experts or MQL5/Experts.
  3. 3Copy the filesCopy the .mq4 / .mq5 file into Experts, and any .mqh files into the Include folder the code expects.
  4. 4Compile in MetaEditorOpen the file in MetaEditor and press Compile. Fix any missing includes the compiler reports.
  5. 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.

Similar expert advisors

AutoTrading Scheduler

by EarnForex
55 stars

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

MT4MT5 Risk & protection
Updated 6 months ago Apache-2.0 GitHub repository of AutoTrading Scheduler
8 stars

JT Prop Firm Trade Manager is a risk management utility for MetaTrader 4 designed to protect accounts from violating equity and drawdown rules. It monitors daily loss limits and maximum drawdown, allowing users to configure thresholds in either currency or percentage. The tool features time-based filters to restrict ov

MT4 Risk & protection

Prop Firm Manager

by pepshirley
5 stars

Prop Firm Manager is a risk management utility for MetaTrader 4 designed to help traders comply with prop firm rules and protect account equity. The tool monitors maximum loss per trade and daily drawdown limits using either fixed dollar amounts or percentages. It manages trading sessions by restricting overnight and w

MT4 Risk & protection

FX Risk Management Collection

by vishnugovind10
4 stars

This MetaTrader 4 collection provides a set of utilities focused on risk management and order execution. It includes scripts and expert advisors designed to automate the closing of open positions and the removal of pending orders. The logic specifically targets closing trades that have reached a specific gain threshold

MT4 Risk & protection

ICCapitals Secure

by ICCapitals
3 stars

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

MT5 Risk & protection
Updated 4 years ago None stated GitHub repository of ICCapitals Secure

Equity Protector

by sacrosK11
3 stars

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

MT5 Risk & protection
Updated 2 years ago None stated GitHub repository of Equity Protector

More risk tools

Need a broker for MT4/MT5?

Compare regulated brokers that support MetaTrader, with spreads, minimum deposits and leverage side by side.

Compare brokers