Popular results

Advertisements
$ £ ¥
¥ £ $

Account Protector

Table of contents

The Account Protector is a MetaTrader expert advisor that lets you manage trades and control your profit and loss across multiple currency pairs using a number of parameters and settings. Here are some examples of the things you can accomplish with the Account Protector:

  • Close all positions once account equity increases by 10%.
  • Delete all EUR/USD pending orders once floating profit on EUR/USD trades reaches $500.
  • Email you the current account state and disable autotrading once free margin drops below $1,000.
  • Trail stop-losses on all trades with non-empty commentary field.
  • Close all positions and exit MetaTrader once total floating profit on trades with magic number "1000" reaches 50 points.
  • Close 50% of the position's volume when profit reaches 100 points.
  • Exit the platform when local time is 23:59 Friday.
  • Enable autotrading when server time is 8:00 on any day.
  • Close all losing trades when total floating loss falls down to $100.
  • Close all trades when the current chart's price reaches a given level and stays there for 10 seconds.
  • Disable autotrading when the account margin level falls below a certain level.
  • Close all positions when spread decreases below a given value.
  • Cease all trading operations when a given daily loss is reached.
  • Close all other charts based on deviation from equity snapshot captured by another instance of the Account Protector.
  • Close all short trades when the number of open positions reaches 5.

The Account Protector's main benefits include:

  • You control all the main settings using a graphic panel.
  • You can close, minimize, and move the panel freely across the chart.
  • Settings can be adjusted inside the panel with just a few mouse clicks.
  • You can apply mass breakeven and trailing stop mechanism to secure your profit.
  • Hidden trailing stop-loss by account equity.
  • You can set it to trigger by timer (including recurring).
  • You can choose whether to count swaps and commission when calculating profit/loss.
  • The panel displays the current instrument's spread.
  • Two snapshots (free margin and equity) are available for advanced trigger conditions.
  • You can filter trades by magic numbers, instrument, trade direction, profit, and order commentaries.
  • You can combine as many conditions and filters as you like.
  • The panel can inform you about its actions via email and mobile push-notifications.
  • The panel automatically saves and loads its settings on timeframe change or platform restart, preserving your configuration efforts.
  • You can use a custom settings file to pre-fill the panel fields according to your preference.
  • It uses only one standard Windows DLL (to disable autotrading) — the EA can work without DLLs if you do not need it to disable autotrading.
  • You can use it in MetaTrader 4 and MetaTrader 5 (both hedging and netting modes).
  • The panel scales properly on high-DPI screens (4K, for example).
  • You are free to browse and modify its open-source code.

Interface

Main tab

The main tab of the panel serves to control the trailing stop and breakeven settings as well as free margin and equity snapshots. The same tab is used to control the equity trailing stop. Also, you can use it to set the timer and to choose whether to count swaps and commission as profit and loss. Additionally, this tab displays the current spread. All the tabs show the expert advisor's status:

Account Protector - Interface - Main Tab

Timer is an optional feature to perform the EA's action at some specific time. To turn it on, you need to set the checkbox and the time (trading server or local PC time) when you want expert advisor's actions to be executed (not the time until those actions get triggered). You can also set the day of the week for the timer to set off.

Trailing stop and breakeven are set similarly — by clicking the checkbox and setting the relevant value in the input field:

  • The first trailing input allows you to set the profit level in points when the trailing stop is first activated. For example, 100 points; when position will reach at least 100 points profit, the trailing stop will be applied using the stop distance from the next input field.
  • The actual trailing stop distance to be used.
  • The first breakeven input field is the target number of profitable points (or currency units) when the stop-loss is moved to breakeven.
  • The input field below lets you enter the number of extra points to add to the breakeven level if you want to capture some minimum profit with the trade. This value is useless if the main breakeven value is not set.
  • The final input field lets you set the equity trailing stop value in account currency or percentage points. When there is an active equity stop-loss value, it is displayed under the checkbox and there is also a button to reset it. You can choose whether to get an alert on equity trailing stop triggering and whether to disable the trailing mechanism after it had triggered.

Filters tab

This tab lets you restrict which trades are monitored and managed by the Account Protector using magic numbers, order symbol, profit, direction, and commentary.

Account Protector - Interface - Filters Tab

The magic number field lets you input several numeric values and either force the EA to work with the trades associated with these numbers or exclude such trades from being processed by the EA. Symbol filtering is organized as a group of radio buttons with explicitly described choices. Order commentary filtering is based on a textual input field and a choice of whether to look for exact match, comments containing the text, comments not containing the text, or comments not equal the entered text.

Losing and profitable trades filter can be selected using two checkboxes, while the order direction filter uses a drop-down menu.

Conditions tab

In this tab, you can set the conditions to trigger the EA's actions.

Account Protector - Interface - Conditions Tab

The first 12 conditions involve floating profit/loss and they trigger if:

  • Floating loss rises to a given percentage of the balance. E.g., paper loss becomes greater or equal to 20% of the balance.
  • Floating loss falls to a given percentage of the balance. E.g., paper loss becomes less or equal to 20% of the balance.
  • Floating loss rises to a number of currency units. E.g., paper loss becomes greater or equal to $100.
  • Floating loss falls to a number of currency units. E.g., paper loss becomes less or equal to $100.
  • Floating loss rises to a number of points. E.g., paper loss becomes greater or equal to 50 points.
  • Floating loss falls to a number of points. E.g., paper loss becomes less or equal to 50 points.
  • Floating profit rises to a given percentage of the balance. E.g., paper profit becomes greater or equal to 40% of the balance.
  • Floating profit falls to a given percentage of the balance. E.g., paper profit becomes less or equal to 40% of the balance.
  • Floating profit rises to a number of currency units. E.g., paper profit becomes greater or equal to $200.
  • Floating profit falls to a number of currency units. E.g., paper profit becomes less or equal to $200.
  • Floating profit rises to a number of points. E.g., paper profit becomes greater or equal to 100 points.
  • Floating profit falls to a number of points. E.g., paper profit becomes less or equal to 100 points.

Any of these 12 conditions can be disabled and hidden via the EA's input parameters.

The next two conditions compare account equity to a given amount of money:

  • Equity becomes less or equal to a given number of currency units. E.g., equity falls to or below $800.
  • Equity becomes greater or equal to a given number of currency units. E.g., equity rises to or above $1200.

Then, there are four conditions that compare account equity to the previously captured snapshot:

  • Equity becomes less or equal to a given percentage of snapshot. E.g., equity falls to or below 90% of the previously captured snapshot.
  • Equity becomes greater or equal to a given percentage of snapshot. E.g., equity rises to or above 115% of the previously captured snapshot.
  • Equity minus snapshot becomes greater or equal to a number of currency units. E.g., equity becomes $100 higher than the previously captured snapshot.
  • Snapshot minus equity becomes greater or equal to a number of currency units. E.g., equity becomes $150 lower than the previously captured snapshot.

Similar conditions exist for free margin. The first two conditions compare it to some amount of money:

  • Free margin becomes less or equal to a given number of currency units. E.g., free margin falls to or below $500.
  • Free margin becomes greater or equal to a given number of currency units. E.g., free margin rises to or above $750.

The next two conditions compare free margin to a snapshot:

  • Free margin becomes less or equal to a given percentage of snapshot. E.g., free margin falls to or below 80% of the previously captured snapshot.
  • Free margin becomes greater or equal to a given percentage of snapshot. E.g., free margin rises to or above 130% of the previously captured snapshot.

The next two conditions analyze the current chart's price:

  • The current price becomes greater or equal to a given value. E.g., the current EUR/USD chart's price goes to 1.2000 or above.
  • The current price becomes less or equal to a given value. E.g., the current EUR/USD chart's price goes to 1.1000 or below.

Then follow two conditions that work with the margin level (that is, account's equity divided by used margin):

  • Margin level becomes greater or equal to a given percentage value. E.g., margin level rises to or above 110%.
  • Margin level becomes less or equal to a given percentage value. E.g., margin level falls to or below 55%.

Then there are two conditions for the current instrument's spread:

  • Spread becomes greater or equal to a given number of points. E.g., spread goes up to 100 points.
  • Spread becomes less or equal to a given number of points. E.g., spread falls to 10 points.

The next group consists of six conditions that analyze the account's daily profit or loss. You can enter negative values for loss comparison and positive values for profit comparison. The Account Protector uses server time to determine the start of the day for these conditions and includes the floating profit/loss in its calculations:

  • Daily profit/loss greater or equal to a given number of currency units. E.g., total daily profit goes to 100 USD or above.
  • Daily profit/loss less or equal to a given number of currency units. E.g., total daily profit falls to -100 USD or below.
  • Daily profit/loss greater or equal to a given number of points. E.g., total daily profit goes to 250 points or above.
  • Daily profit/loss less or equal to a given number of points. E.g., total daily profit falls to -300 points or below.
  • Daily profit/loss greater or equal to a percentage value of the daily starting account balance. E.g., total daily profit goes to 5% or higher.
  • Daily profit/loss less or equal to a percentage value of the daily starting account balance. E.g., total daily profit falls to -3% or less.

The final group of conditions concerns the number of orders and positions:

  • The number of positions greater or equal to a given number. E.g., the total number of open positions rises to 5.
  • The number of positions less or equal to a given number. E.g., the total number of open positions falls to 0.
  • The number of orders greater or equal to a given number. E.g., the total number of pending orders rises to 6.
  • The number of orders less or equal to a given number. E.g., the total number of pending orders declines to 1.

After a condition is triggered, its checkbox will be unchecked unless DoNotDisableConditions is set to true.

Actions tab

This tab lets you select the actions that should be executed if your chosen conditions are met.

Account Protector - Interface - Actions Tab

Nine actions are supported by the Account Protector:

  • Close % of positions will close (fully or partially) selected active trades (all, losing, or profitable) in all trading instruments that are not filtered out (using the Filters tab) and where trading is enabled.
  • Delete all pending orders will remove all stop, limit, and stop-limit orders in all trading instruments that are not filtered out (using the Filters tab) and where trading is enabled.
  • Disable autotrading will turn off the platform's AutoTrading button preventing further operation of all expert advisors. The Account Protector uses a call to one of user32.dll functions to emulate the button press. The action will not work if DLLs are disabled.
  • Send e-mail will notify you using an e-mail if there are correct settings under Tools->Options->Email menu. One e-mail message will be sent with brief description of what condition has been met and what actions have been taken.
  • Send push notifications will inform you using mobile push notifications if there are correct settings under Tools->Options->Notifications menu. Two notifications will be sent with brief description of what condition has been met and what actions have been taken.
  • Close platform will close the MetaTrader platform. This will prevent any further operation of the attached expert advisors.
  • Enable autotrading will turn on the platform's AutoTrading button, enabling other expert advisors to function properly. The Account Protector uses a call to one of user32.dll functions to emulate the button press. The action will not work if DLLs are disabled.
  • Recapture snapshots will capture the equity and margin snapshots.
  • Close all other charts will close all charts in the platform except for the current chart where the current instance of the Account Protector is operating.

After some action is taken, its checkbox will be unchecked unless DoNotDisableActions is set to true.


Usage

The aim of the Account Protector (AP) is to help you preserve your account balance. AP works based on the conditions and actions you set. The actions are applied at the moment when at least one of the conditions is triggered (unless there a delay set via the ConditionDelay input parameter). The graphic panel helps you operate the expert advisor.

You can ensure proper operation of AP by turning the AutoTrading button on in your MetaTrader terminal. Allowing DLL imports enables AP to automatically disable (or enable) autotrading when you configure it to do so. The expert advisor will alert you if either AutoTrading button or DLL imports are off but will continue operating in a restricted mode.

The EA will apply trailing stop-loss and breakeven stops if you configure it via the Main tab and enable autotrading.

If you set Enable emergency button input parameter to Yes, a big red emergency button will appear at the bottom of the Main tab. You can press it to close all positions, delete all pending orders, and disable autotrading immediately. The emergency button respects all filters set via the Filters tab.

Status

You can monitor the status of the Account Protector by looking at the panel's top line. It shows the current state of the panel (ON or OFF) and its current status as one of the six possible values:

  • Autotrading is disabled — the expert advisor will not be able to perform any trading operations until autotrading is enabled.
  • No condition is set — you need to set some condition in the Conditions tab for the EA to trigger and to take some actions.
  • No action is set — you need to set some action in the Actions tab for the AP to do anything when a condition triggers.
  • OK (but turned OFF) — the Account Protector is ready to start working once you turn it on using the Switch button.
  • OK — the AP is fully operational and will take some actions when at least one of the given conditions is met.
  • Triggered at — appears after some condition has triggered.

Logging

When AP is attached to the chart, it logs the trading account information and its input parameters if the log file name is set.

During its operation, AP logs the following events:

    • When some condition is triggered, AP logs the name of that condition, current account information, and all the panel settings.
    • When some action is taken, AP logs the name of that action and the detailed list of all the closed positions and deleted pending orders.
    • AP logs error messages (when some entered input value is invalid).
    • It is possible to see most of the log messages inside the Experts tab of the MT4/MT5 terminal.
    • When you remove AP from the chart, it again logs all the relevant trading account information and its own input values.

Each line of the log file is accompanied by a timestamp based on the platform's local time.


Input parameters

Main

  • Enable emergency button (default = No) — if Yes, the emergency button will be present on the panel for quick removal of all trades and disabling of autotrading.
  • DoNotDisableConditions (default = false) — if true, the triggered condition's checkbox will not get unchecked on the Conditions tab.
  • DoNotDisableActions (default = false) — if true, the triggered action's checkbox will not get unchecked on the Actions tab. It is not recommended to set this parameter to true unless you are completely certain in what you are doing.
  • DoNotDisableEquityTS (default = false) — if true, the equity trailing stop will remain active after triggering and new trades will continue get their stop trailed by the Account Protector.
  • DoNotDisableTimer (default = false) — if true, the timer will continue running after it triggers and will trigger again at the same time next day (or week).
  • ConditionDelay (default = 0) — the number of seconds to wait for the condition to remain active before triggering the actions.
  • CountFloatingInDailyPL (default = true) — if true, the floating profit/loss will be counted in the daily profit/loss conditions.

Conditions

  • DisableFloatLossRisePerc (default = false) — if true, the "Floating loss rises to %" condition is disabled.
  • DisableFloatLossFallPerc (default = true) — if true, the "Floating loss falls to %" condition is disabled.
  • DisableFloatLossRiseCurr (default = false) — if true, the "Floating loss rises to currency units" condition is disabled.
  • DisableFloatLossFallCurr (default = true) — if true, the "Floating loss falls to currency units" condition is disabled.
  • DisableFloatLossRisePoints (default = false) — if true, the "Floating loss rises to points" condition is disabled.
  • DisableFloatLossFallPoints (default = true) — if true, the "Floating loss falls to points" condition is disabled.
  • DisableFloatProfitRisePerc (default = false) — if true, the "Floating profit rises to %" condition is disabled.
  • DisableFloatProfitFallPerc (default = true) — if true, the "Floating profit falls to %" condition is disabled.
  • DisableFloatProfitRiseCurr (default = false) — if true, the "Floating profit rises to currency units" condition is disabled.
  • DisableFloatProfitFallCurr (default = true) — if true, the "Floating profit falls to currency units" condition is disabled.
  • DisableFloatProfitRisePoints (default = false) — if true, the "Floating profit rises to points" condition is disabled.
  • DisableFloatProfitFallPoints (default = true) — if true, the "Floating profit falls to points" condition is disabled.
  • DisableCurrentPriceGE (default = true) — if true, the "Current price greater or equal" condition is disabled.
  • DisableCurrentPriceLE (default = true) — if true, the "Current price less or equal" condition is disabled.
  • DisableEquityMinusSnapshot (default = true) — if true, the "(Equity - snapshot) greater or equal" condition is disabled.
  • DisableSnapshotMinusEquity (default = true) — if true, the "(Snapshot - equity) greater or equal" condition is disabled.
  • DisableMarginLevelGE (default = true) — if true, the "Margin level greater or equal" condition is disabled.
  • DisableMarginLevelLE (default = true) — if true, the "Margin level less or equal" condition is disabled.
  • DisableSpreadGE (default = true) — if true, the "Spread greater or equal" condition is disabled.
  • DisableSpreadLE (default = true) — if true, the "Spread less or equal" condition is disabled.
  • DisableDailyProfitLossUnitsGE (default = true) — if true, the "Daily profit/loss greater or equal units" condition is disabled.
  • DisableDailyProfitLossUnitsLE (default = true) — if true, the "Daily profit/loss level less or equal units" condition is disabled.
  • DisableDailyProfitLossPointsGE (default = true) — if true, the "Daily profit/loss greater or equal points" condition is disabled.
  • DisableDailyProfitLossPointsLE (default = true) — if true, the "Daily profit/loss level less or equal points" condition is disabled.
  • DisableDailyProfitLossPercGE (default = true) — if true, the "Daily profit/loss greater or equal %" condition is disabled.
  • DisableDailyProfitLossPercLE (default = true) — if true, the "Daily profit/loss level less or equal %" condition is disabled.
  • DisableNumberOfPositionsGE (default = true) — if true, the "Number of positions greater or equal" condition is disabled.
  • DisableNumberOfOrdersGE (default = true) — if true, the "Number of positions less or equal" condition is disabled.
  • DisableNumberOfPositionsLE (default = true) — if true, the "Number of pending orders greater or equal" condition is disabled.
  • DisableNumberOfOrdersLE (default = true) — if true, the "Number of pending orders less or equal" condition is disabled.

Trading

  • DelayOrderClose (default = 0) — a delay in milliseconds between closing orders. This parameter can help with not spamming your broker's trading server with orders.
  • UseTotalVolume (default = false) — if true, the Account Protector will consider the total volume it has already closed when partial closure is set up. This is particularly useful when trading with multiple low-volume positions.
  • CloseFirst (default = "No order, as quickly as possible") — determines how positions are sorted for closing:
    • No order, as quickly as possible — the Account Protector won't sort positions. It will close them based on MetaTrader's internal order. If the closing action is triggered by some condition based on floating profit or loss, it will still sort the trades in descending order.
    • Most distant trades first — the Account Protector will sort and close trades starting from the most distant ones (counting from open prices). This will work irrespective of which condition is triggered.
    • Nearest trades first — the Account Protector will sort and close trades starting from the nearest ones (counting from open prices). This will work irrespective of which condition is triggered.
    • Most profitable trades trades first — the Account Protector will sort and close trades starting from the most profitable ones (by floating profit). This will work irrespective of which condition is triggered.
    • Most losing trades first — the Account Protector will sort and close trades starting from the most losing ones (by floating loss). This will work irrespective of which condition is triggered.
  • BreakEvenProfitInCurrencyUnits (default = false) — if true, the breakeven distance on the Main tab is set in currency units rather than points.
  • EquityTrailingStopInPercentage (default = false) — if true, the hidden equity trailing stop distance will be set in percentage points instead of currency units.

Miscellaneous

  • AlertOnEquityTS (default = false) — if true, a pop-up alert will be displayed when the hidden equity trailing stop is triggered.
  • AdditionalFunds (default = 0) — additional funds will be added to account balance, equity, and free margin. This can be useful if you want the Account Protector to act as if you have more (or less) money in your account than there really is.
  • Instruments (default = "") — the default list of trading instruments to use with the trade filter.
  • GlobalSnapshots (default = false) — if true, all the Account Protector instances in the platform will share their equity and margin snapshots between each other. The latest snapshot update will get propagated to all the AP instances that have this input parameter set to true.
  • Slippage (default = 2) — slippage value given in broker's points to be used when closing positions.
  • Log file name (default = "ap_log.txt") — if given, the Account Protector will log its settings and events into that file.
  • Settings file (default = "") — if given, the Account Protector will load panel settings from that file. The file can only be loaded from the \MQL4\Files\ or \MQL5\Files\ subfolder of your platform's data folder.
  • Silent (default = false) — if true, the Account Protector won't log anything to the Experts tab of the terminal. Can be useful to avoid the flood of log messages.

Download (ver. 1.11, 2024-06-19)

The Account Protector is being developed via a dedicated GitHub repository. You are encouraged to actively participate in the improvement of this expert advisor by submitting your own features via pull-requests and by reviewing existing suggestions, changes, fixes, and so on.

Account Protector for MetaTrader 4Download

Account Protector for MetaTrader 5Download

To install — unzip and copy the entire Account Protector folder to \MQL4\Experts\ or \MQL5\Experts\ (if you are on MetaTrader 5) of your terminal's data folder. When compiling the Account Protector in MetaEditor, make sure you are compiling either AccountProtector.mq4 or AccountProtector.mq5 and NOT AccountProtector.mqh.

Tutorial video

This video demonstrates how to install and use the Account Protector expert advisor:


Frequently asked questions

Can Account Protector disable autotrading first and only then proceed to close positions and delete orders?

Unfortunately, no. Account Protector, itself being an expert advisor, needs autotrading to be enabled to close positions and delete orders.

Discussion

Do you have any suggestions or questions regarding this expert advisor?

Discuss the Account Protector with other traders and MQL coders on the forum.


Changelog

Warning! The MT5 version now uses UTF-8 settings file format. Updating from version 1.09 or older will likely cause a failure to load your old settings file correctly.

1.11 — 2024-06-19

  • Added an option to switch the hidden equity trailing stop to percentage (EquityTrailingStopInPercentage).
  • Added a silent mode to avoid outputting the AP's log messages to the Experts tab of the platform (Silent).
  • Added a special mechanism to avoid cyclical triggering of daily profit/loss conditions in some cases.
  • Changed the default log file name from log.txt to ap_log.txt.
  • Changed how autotrading status is detected and reported. The Account Protector will now be more specific.

1.10 — 2023-06-20

  • Added an option to calculate only realized profit/loss in the daily profit/loss conditions (CountFloatingInDailyPL).
  • Added a trigger delay option (ConditionDelay) to wait for the condition to remain active for a given amount of time before actions are triggered.
  • Added an option to load your custom settings file with panel fields' values (Settings file).
  • Added four new conditions based on the number of positions and pending orders.
  • Added a global ON/OFF state for the panel to avoid unexpected triggering of actions, trailing stop, or breakeven.
  • Added a new filter to the Filters tab to target long and short trades separately.
  • Changed how you can control the way the positions are sorted before closing (see the CloseFirst input parameter).
  • Fixed the file encoding used for the panel's settings file in MT5. It is now UTF-8. This probably means that the Account Protector will fail to load your old settings file correctly.
  • Fixed a bug in the MT4 version of the EA that resulted in deposits and withdrawals being counted in the daily profit/loss conditions.
  • Fixed decimal places normalization in some condition fields.
  • Fixed the placement of fields on the Filters tab to avoid overlapping problems in MT4.
  • Optimized the EA initialization and deinitialization phases to significantly improve the loading speed when switching the chart symbol.
  • Removed the PanelOnTopOfChart input parameter. Use the 'Chart on foreground' checkbox in the chart's settings instead.

1.09 — 2022-12-21

  • Added an input parameter (BreakEvenProfitInCurrencyUnits) to let the breakeven distance field optionally accept values in the account currency units rather than points.
  • Added an input parameter (GlobalSnapshots) to let two or more Account Protector instances running in the same platform share their equity and margin snapshots with each other.
  • Added an input parameter (DoNotDisableTimer) to enable a persistent timer with recurring action triggering.
  • Added the Close all other charts action to enable smart disabling of all other expert advisors.
  • Improved position closing performance when no filters are set.
  • Fixed a potential division by zero error when a daily profit/loss condition is enabled.
  • Fixed erroneous triggering of the margin level condition when there are no open trades.
  • Fixed a bug (MT4 only) when the panel didn't properly remember its selected tab.
  • Fixed a minor error with the ArraySort() function.
  • Clarified the daily profit/loss percentage condition levels by adding that they are based on the account balance.

1.08 — 2022-06-15

  • Added an input parameter (DoNotDisableEquityTS) to not disable equity trailing stop upon triggering.
  • Added an input parameter (AlertOnEquityTS) for an optional alert upon equity trailing stop triggering.
  • Added an input parameter (CloseMostDistantFirst) to specify for the expert advisor to close trades starting from the most distant one (open price minus current price as distance).
  • Renamed input parameter DoNotResetConditions to DoNotDisableConditions and DoNotResetActions to DoNotDisableActions to avoid confusion.
  • Fixed a critical bug that prevented position closing when log file was set to empty.
  • Fixed a bug that prevented log file from working properly even when there was no error opening it.

1.07 — 2022-02-16

  • Fixed equity trailing stop to actually close trades when a trailing stop is hit.

1.06 — 2022-02-08

  • Added a condition based on the current trading instrument's spread.
  • Added a condition based on the account's margin level.
  • Added a set of conditions based on the daily profit/loss.
  • Added a filter for profitable/losing trades.
  • Improved the instrument filter to accept a list of included/excluded trading instruments.
  • Improved panel's compatibility with other panel indicators and EAs.
  • Improved performance when checking some particularly slow conditions.
  • Optimized magic number filtering process.
  • Fixed a bug that prevented the Emergency Button from closing positions.
  • Fixed a bug that caused the AP to apply the "Breakeven extra profit value (points)" even when the respective checkbox was unchecked.
  • Converted pips to points throughout the expert advisor's interface for clarity.

1.05 — 2021-08-04

  • Added "Equity − snapshot" and "Snapshot − equity" conditions.
  • Added "Chart price" conditions.
  • Added an optional delay between order closing (DelayOrderClose input parameter).
  • Added an option (UseTotalVolume input parameter) to use total volume for close percentage calculation when closing multiple small orders (e.g., 0.01 lot).
  • Added an input parameter (AdditionalFunds) for a trader to specify additional funds to add to the account's balance, equity, and free margin. Could be useful when working with percentage values and not all your trading funds are deposited into your trading account.
  • Changed the Close percentage field in the Actions tab to accept non-integer values.
  • Removed the alert about DLL Imports being disabled. A status line warning should be enough.
  • Fixed the removal of a leftover panel when re-attaching the Account Protector after a critical error.
  • Fixed handling of closed markets in MT5. Now, if a trade should be closed (based on a triggered condition and an action) while its market hours are off, the Account Protector will close it when the market re-opens without flooding the log with error messages.
  • Improved compatibility of the MT5 version with cryptocurrency-denominated accounts and cryptocurrency instruments.

1.04 — 2020-04-17

  • Added "Enable autotrading" action.
  • Added "Recapture snapshots" action.
  • Added an option to close all, only profitable, or only losing positions.
  • Added reverse conditions for loss and profit reaching certain values. This can be used to trigger actions on loss and profit decreasing instead of increasing.
  • Added input parameters to reduce the number of conditions displayed in the tab.
  • Switched from TimeCurrent() to TimeLocal() in logs.
  • Made some logging messages more precise.

1.03 — 2019-09-30

  • Added partial close percentage to Actions tab.
  • Added day of the week for timer.
  • Added support for 8 decimal places in position sizes (MT5 version of the EA only).
  • Added input parameters to disable resetting of Conditions and Actions on trigger.
  • Changed how panel fields behave — inputs can be changed even when the respective checkbox is off; no special EMPTY value to simplify things.

1.02 — 2019-02-12

  • Fixed a bug when Account Protector failed to close positions in MT5 with Immediate or Cancel order filling type.

1.01 — 2017-11-20

  • Added hidden equity trailing stop.
  • Fixed bugs connected with panel minimization and maximization.
  • Fixed duplicate chart objects appearing when saving and loading a chart template with Account Protector.