Account Protector EA

The Account Protector expert adviser is developed by EarnForex and available for MT4 and MT5. You can get it free from GitHub where you can also view and share ideas from other traders who are contributing to this very handy account management tool.

Using a variety of options accessible through an intuitive chart panel, the Account Protector EA enables you to automate emergency position closing as well as other crucial trade management procedures.

From a vast list of possible conditions, you may choose one or more, define position/order filters, establish a trailing stop and break-even trailing, start various actions with a timer, and have an emergency button for an immediate response to undesirable trading circumstances.

I think this is a very useful expert advisor for money management which is an extremely vital part of a successful trading strategy that I think is too often overlooked, especially by novice traders. Good money management can be the difference between a winning and losing forex trading strategy.

Account Protector EA Interface

The Account Protector expert advisor has a very user-friendly interface that makes it a breeze to adjust all of the settings according to your own individual requirements.

Main Tab

The trailing stop and breakeven settings, free margin, and equity snapshots are all managed by the panel’s main tab. The equity trailing stop is managed using the same tab. Additionally, you may use it to configure the timer and decide whether to include commission and swaps in your profit and loss calculations. This page also shows the spread that is in effect right now. The expert advisor’s status is displayed across all tabs:

Account Protector EA Main Tab
Account Protector EA Main Tab

You must select the checkbox and the time (local PC time or the trading server) when you want the expert advisor’s activities to be carried out in order to activate the timer (not the time until those actions get triggered). Additionally, you can specify the timer’s start-up day of the week.

By selecting the checkbox and entering the appropriate value in the input field, trailing stop and breakeven are configured similarly:

  • When the trailing stop is initially triggered, you can specify the profit level in points using the first trailing input. For instance, 100 points; the trailing stop will be implemented using the stop distance from the following input field if the position has reached a profit of at least 100 points.
  • The precise trailing stop distance that must be applied.
  • The goal number of lucrative points (or currency units) when the stop-loss is adjusted to breakeven is entered in the first breakeven input field.
  • If you wish to make a minimum profit on the trade, enter the number of extra points to add to the breakeven level in the input field below. If the primary breakeven point is not determined, this value is meaningless.
  • You can enter the equity trailing stop value in account currency in the last input field. When an equity stop-loss is active, its value is shown underneath the checkbox, and there is a button to reset it. You can decide whether to receive a notification when the equity trailing halt triggers and whether to turn off the trailing mechanism after it has.

Filters Tab

Using magic numbers, order symbols, and order commentary, you can limit which trades the Account Protector is allowed to watch and manage.

Account Protector EA Filters Tab
Account Protector EA Filters Tab

The magic number field allows you to enter a variety of numeric values to either force the EA to process deals linked with these numbers or to ignore such trades entirely. Symbol filtering is arranged as a set of radio buttons with alternatives that are clearly stated. The text input form used for order commentary filtering allows users to select whether to check for exact matches, comments that match the entered text exactly, comments that don’t match the text exactly, or comments that don’t match the text exactly.

Conditions Tab

You can specify the circumstances under which the EA will take action on this tab. If DoNotDisableConditions is not set to true, a condition’s checkbox will remain selected even after it has been activated.

Account Protector EA Conditions Tab
Account Protector EA Conditions Tab

Actions Tab

You can choose which actions should be taken if the conditions you’ve chosen are true on this tab.

Account Protector EA Actions Tab
Account Protector EA Actions Tab

The Account Protector supports the following nine actions:

  • Close% of positions will close (completely or partially) all ongoing transactions (profitable or losing), in all trading instruments where trading is enabled, that are not filtered out using the Filters tab.
  • When a trading instrument is not filtered out (using the Filters tab) and trading is enabled, selecting Delete all Pending Orders will erase all stop, limit, and stop-limit orders in that instrument.
  • The platform’s AutoTrading option will be disabled if auto trading is disabled, which will stop all expert advisors from working in the future. The Account Protector simulates the button press by calling a user32.dll function. The action won’t function if DLLs are turned off.
  • If the settings under the Tools->Options->Email menu are correct, Send Email will send you an email to let you know. The criterion that has been met and the steps that have been performed will be briefly described in one email message.
  • If the settings are correct under Tools->Options->Notifications menu, Send push notifications will alert you utilising mobile push notifications. There will be two notifications, each of which includes a brief explanation of the condition that has been met and the steps that have been followed.
  • Closing the platform will shut down the MetaTrader interface. The attached expert advisors won’t be able to operate further as a result of this.
  • The platform’s AutoTrading button is activated when auto trading is enabled, making it possible for other expert advisors to work as intended. The Account Protector simulates the button press by calling a user32.dll function. The action won’t function if DLLs are turned off.
  • The equity and margin snapshots will be captured by recapture snapshots.
  • Close all other charts will close all platform charts besides the current chart where the active Account Protector instance is located.
  • Unless DoNotDisableActions is set to true, a checkbox will lose its checked state when an action is performed.


Your account balance preservation is the goal of the Account Protector (AP). The circumstances and actions you provide determine how AP operates. When at least one of the prerequisites is met, the actions are put into effect. You can use the expert advisor with the help of the visual panel.

By activating the AutoTrading button in the MetaTrader terminal, you can ensure proper operation of AP. When you configure AP to do so, allowing DLL imports enables it to automatically off (or enable) auto trading. If the AutoTrading button or DLL imports are disabled, the expert advisor will notify you and operate in a limited manner.

If you set up the EA using the Main tab and select auto trading, it will apply trailing stop-loss and breakeven stops.

A large red emergency button will show up at the bottom of the Main tab if you set the Enable emergency button input option to Yes. Pressing it will immediately stop auto trading, close all open positions, and erase all open orders. All filters selected in the Filters tab are respected by the emergency button.


By observing the top line of the panel, you may keep track of the Account Protector’s condition. The current condition is displayed as one of the five possible values:

  • Auto trading disabled – The expert adviser cannot execute any trades until auto trading is enabled, which is why it is disabled.
  • There is no condition set – you must set a condition in the Conditions tab before the EA will activate and take action.
  • No action is set – in order for AP to take any action when a condition triggers, an action must be set on the Actions tab.
  • OK – the Automatic Positioning system is fully functioning and will act when at least one of the predetermined circumstances is met.
  • Triggered at – After some condition has been met, or activated at.


If the log file name is set, AP logs the trading account details and its input parameters when it is tied to the chart.

The following events are recorded by the AP when it is in use:

  • When a condition arises, AP records the circumstance’s name, the account’s current information, and all panel settings.
  • The name of the action taken as well as a full list of all closed positions and deleted pending orders are recorded by AP whenever a certain action is taken.
  • APN error messages (when some entered input value is invalid).
  • The majority of the log messages can be viewed on the MT4/MT5 terminal’s Experts tab.
  • The AP once more logs all pertinent trading account data as well as its own input values when you remove it from the chart.
  • A timestamp depending on the platform’s local time appears next to each line in the log file.

Account Protector EA Features

The Account Protector EA is packed with useful features when it comes to managing your open positions and account balance. Below are a few examples of what it is capable of doing, all of which you can adjust according to your own needs.

  • Once the account equity has increased by 10%, close out all holdings.
  • As soon as the floating profit on EUR/USD trades hits $500, cancel all pending EUR/USD orders.
  • Once free margin falls below $1,000, auto trading will be disabled and you will be emailed the current account status.
  • All trades with a remark box that is not empty have trailing stop-losses.
  • Once the total floating profit on trades using the magic number “1000” hits 50 points, close all open positions and quit MetaTrader.
  • When profit exceeds 100 points, close out 50% of the volume of the position.
  • When Friday at 23:59 local time, leave the platform.
  • When the server time is 8:00 on any day, enable auto trading.
  • When the floating loss total reaches $100, close out all losing deals.
  • When the price on the current chart reaches a certain level, close all open positions.
  • When the account margin level drops below a particular threshold, disable auto trading.
  • When the spread falls below a certain amount, all positions should be closed.
  • When a certain daily loss is reached, all trading must stop.
  • Close any additional charts that differ from the equity snapshot recorded by another Account Protector instance.

Account Protector EA Benefits

It goes without saying that having some of your repetitive money management tasks automated can help to save time and ensure you are executing and managing your trades with as much efficiency as possible. Amongst the core benefits of the Account Protector EA for MetaTrader, you will find the following:

  • A visual panel is used to control all the major parameters.
  • The panel can be minimised, closed, and moved about the chart at will.
  • Within the panel, settings can be changed with a few mouse clicks.
  • To ensure your profit, you might use the mass breakeven and trailing stop mechanisms.
  • By account equity, a hidden trailing stop-loss.
  • You can programme a timer to activate it (including recurring).
  • You can decide whether to include swaps and commissions in your profit/loss calculation.
  • The spread of the current instrument is shown on the panel.
  • For advanced trigger circumstances, there are two snapshots available: equity and free margin.
  • Trades can be filtered using instruments, order remarks, and magic numbers.
  • As many conditions and filters as you want can be combined.
  • Email and mobile push alerts are two ways the panel can let you know what it is doing.
  • On timeframe changes or platform restarts, the panel automatically stores and loads its settings, maintaining your configuration work.
  • The EA can function without DLLs if you don’t need to disable auto trading because it just utilises one standard Windows DLL.
  • Both MetaTrader 4 and MetaTrader 5 support its use (both hedging and netting modes).
  • On high-DPI screens, the panel scales correctly (4K, for example).
  • Its open-source code is available for you to explore and edit.

Conclusion: do I need the Account Protector EA?

If you are looking for a quick and easy way to manage your forex trades, the Account Protector EA for MetaTrader is an excellent option. It has a ron of helpful features that can be fully customised according to your own needs. It is one of the most complete money management expert advisors that I have come across and what’s more, it is free to use.

Free Forex Robot