This article is written to form a comprehensive understanding of the basics of working with the AW RecoverySystem Expert Advisor (hereinafter AWRS ). We will analyze in detail how to test drawdowns and what settings need to be changed to obtain certain results.
First of all, I’ll note additional information that will not be affected in this article, but prepared elsewhere -
- A complete list of input settings of the adviser with comments on each variable. Link to the article - https://www.mql5.com/en/blogs/post/726207
- Description of all three Expert Advisor panels with comments on the elements. Link to go to the article - https://www.mql5.com/en/blogs/post/726281
- Description of the auto-calculation function and work with it. Link to the article - https://www.mql5.com/en/blogs/post/728143
The article contains the following sections:
- The beginning of testing, testing an individual situation.
- The actions that the adviser performs when it exits the standby mode.
- Calculation of the step between averaging orders and trading volumes. An example of calculating the main variables.
- Trend Filters. Selection and customization.
- Auto Lock How does it work and when should it be turned off.
- The current group of orders. What is it and how is it calculated.
- Additional functions. Set up notifications.
- Additional functions. Identifiers and their change.
1. The beginning of testing, testing a particular situation.
In order to test the adviser, you must enable the "Visualization" mode in the strategy tester.
If the checkbox does not have this checkbox in the settings window, then try to stretch the window in height, the fact is that the "Visualization" is hidden when the window is compressed.
To test a specific drawdown, you should choose a deposit amount similar to the one you plan to restore.
Testing should be carried out using the launch at drawdown, you can select it in the input settings. In the " Type of the launch " variable, select the drawdown mode, and set its value in the " Drawdown in percentage or in money to run" variable. Now, when testing, the adviser will not start working until the specified drawdown is reached.
Using the bottom right panel, open the required volume of orders. You should use at least the amount that is available in the real drawdown, but it is better to test the EA with a small margin so that the volume of the loss-making position is slightly larger than the real one and the drawdown is also slightly larger.
Once the drawdown reaches the set, AW Recovery System will begin to restore the position.
2. The actions that the adviser performs at the time of exiting the standby mode.
When the EA exits the standby mode or starts in the " Instant Start " mode, it performs a certain amount of operations. Let's look through them to understand their relevance in a given situation.
Disabling other advisors.
At the beginning of work, the first test AWRS performs is the function to disable other advisors. It is governed by the variable " Close other charts with same symbol at start ". If this variable is enabled, then at the time of launch the adviser will close other windows with a similar tool. This is done in order to disable the advisers tied to these windows. This function is relevant when starting AWRS in standby mode with another advisor on VPS. The function facilitates the observance of one of the most important conditions - when automatic locking is turned on, it is necessary to disable the Expert Advisor that you plan to restore. I draw your attention to the fact that when you reboot or change the input settings, RS will again work out this function at startup.
Removing TP and SL, as well as closing profitable orders.
One of the actions relevant for position management is to delete pending orders, TakeProfit and StopLoss levels of AWRS orders processed. This is important so that the position aligned to the castle does not decrease or increase in volume, that is, that orders are processed only from AWRS.
Also, at startup, AWRS will close profitable orders to free up additional funds for subsequent processing, as well as to close losing orders, if possible. The function of closing orders at start only closes orders entirely. When the EA reboots, it should also be disabled.
The variables that control the above settings are marked in the image below.
3. Calculation of the step between averaging orders and trading volumes. An example of calculating the main variables.
Different settings should be used depending on the instrument used, the amount of deposit and the selected risk management model of the trader. In this section, we will analyze one of the options for calculating volumes, pay attention to those variables that govern the aggressiveness of the adviser.
First of all, you should calculate the step between averaging orders. That is, a step in points between those orders with which AWRS will close a losing position.
- It is advisable to calculate the step between orders based on the current volatility. To do this, you can use the ATR indicator, included on the daily timeframe. The readings of this indicator indicate what average daily volatility for the selected instrument is currently. And therefore, what step should be between the averaging orders of the adviser. For medium activity, half ATR can be used, for high activity opening orders 1/3. In the case of strong news movements, the shift in volatility from average values due to economic news should be considered.
- The volume of the first restoring order and the calculation of the closing part are based on the step, the distance from the effective order and the chosen strategy for managing the trader's money. It is necessary that for the passage of one average daily range, the averaging order could close part of the distant losing order. In order for closure to occur most quickly, you should use the closing part with a smaller or equal volume to the volume of the first averaging order.
- After calculating the step and order volumes, select the multipliers for subsequent averaging orders in the grid. Two multipliers are available - this is the multiplier of the volume of subsequent orders (the variable " Multiplier for AWRS orders ") and the step multiplier between the averaging orders (the variable " Multiplier to step for AWRS orders ").
An example of calculating the parameters on the real situation of the trader.
After we have examined the calculation of variables, we should describe the calculation of these variables using a living example. As an example, we will use the drawdown of one of the traders who published our joint calculation of the input settings with him. In order to start this calculation, let's get acquainted with this situation -
The EA was launched on the EURUSD symbol, according to the ATR Daily 24, the average daily volatility was 510 points of a 5-digit quote. The drawdown was 8712.74 Australian dollars, the total open position of 5.40 lots.
In this situation, first of all, we look at the average daily volatility. ATR 24 (Daily), it is 510 points on a five-digit quote. Now let's look at the distance from the farthest losing order to the current price. The distance is 1583 points of a five-digit quote. We need to open a recovery order in order to close part of this losing order. Taking into account the daily passage of the price, we get that in order to close 0.01 from a distant losing order, we must profit from passing 510 points from the closing part in order to get at least 15.83 profit (distance * volume). That is, we need to get $ 15 for 500 points, that is, 500/15 = 0.03 of the opening volume, at least for each closure of 0.01, but if I take into account the daily accrual of swaps, I will use 0.04 for each 0.01. That is, to close 0.05 (as in the settings used by the trader), we need to open 0.20 for the first order. When accounting for such volumes, I would recommend using a trend filter and a time frame of at least M30.
If it is appropriate to increase the risks, one can rely on all-day volatility or part of this volatility. For my trading, I rely on half the volatility of the day, that is, I would work not with 510, but with 255 for the step between averaging orders.
This is when it comes to calculating the minimum volume. If we talk about other variables, then I calculate the step between orders as part of the average daily movement, that is, if I put it at high risk, I use 1/3 of the daily ATR as a step when accounting for filters, for medium risks - half the daily volatility. There are two things to keep in mind - a too small step will increase the risks, while a too large step may turn out to be ineffective and pointless if the adviser cannot close orders faster than swaps are charged.
If there are large volumes, you should take a responsible approach to opening orders, AWRS can open orders on your own, a trader can open orders using the advisor panel, opening averaging orders through it (the variable " Group for opened orders via panel " = " Restorative_group_of_orders "),
and also AWRS can only accept orders opened by another advisor (" Allowed types of AWRS orders " = " Without opening ").
A large number of options will allow the trader to flexibly approach the issue of restoring the position and make this process more efficient. It is also worth noting that not all situations can be restored.
4. Trend filters. Selection and customization.
One of the most important items for setting up an adviser is setting up trend filters. That is, setting up finally confirming signals for opening an averaging order. Filters are regulated in the variable " Type of filtering for recovery orders "
AWRS has the following selection of filters - Alligator, 2 MAs, Parabolic SAR, SimpleTrend and Heiken Ashi candles, which filter the opening of averaging orders for the current trend. All settings are available for each filter, as well as the choice of time frame by which the EA will analyze the trend. The fact that AWRS holds no more than one averaging order per candle on the current timeframe makes it possible to use the timeframe of the trend filter that is different from the current one.
5. Automatic locking. How does it work and when should it be turned off.
First of all, I note that the work of automatic locking, like many other functions considered by us, is discussed in detail in the video instruction for the adviser, which is posted below.
Locking as such is the alignment of the position in the castle. That is, the adviser aligns the volume of orders of the OP_BUY and OP_SELL types. This is done so that the position is fixed in the current position and its loss does not increase due to price movements. The automatic locking is enabled in the input settings of the adviser, the " Allow auto locking " variable. In the event that locking is enabled, the adviser will align all orders that can process except average ones into the lock. Thus, the loss will be fixed in the current position automatically.
Automatic locking is valid throughout the entire adviser operation time, that is, in those cases when it cannot actively be closed manually or manually open additional orders - the locking algorithm will work. That is, with the relevance of adding, closing orders, you should disable locking. Also, parallel operation with other algorithms is possible only with automatic locking disabled. In general, automatic locking is relevant only for those situations where the processed orders are not affected from the outside and there is the opportunity to give AWRS the opportunity to individually manage the position.
Also, if you have AWRS running on VPS, you should either disable the version that works on the terminal of your computer or disable the ability to open orders so that two AWRSs cannot conflict with each other
6. The current group of orders. What is it and how is it calculated.
When working, AWRS does not close individual orders entirely. The entire position, divided into orders, is virtually divided into smaller parts. The EA closes individual orders in parts, closing part of the order requires less generated profit, as well as a smaller amount of averaging orders required to open. It is the work with partial closure that allows you to restore positions more safely.
The current group itself is the parts virtually closed from the position to close from the long and short positions, as well as averaging orders with which parts of the position will be closed. Data on volumes, number of orders and profits of the current group are displayed in the panel of the current group. Also, using this panel, you can close the current group being processed in one click.
When calculating the group, swaps and commissions of unprofitable and averaging orders are taken into account. Also, if ECN accounts are used by a broker, additional commissions can be written off for partial closing for the entire volume of orders formed as a result of closing, that is, for the full balance at each part closing. These calculations of additional fees are accounted for using the variable " TrueECN_Type_of_account ". In case of using an ECN account
7. Additional features. Set up notifications.
AWRS Advisor can send three types of notifications, these are
- Sending an email.
- Sending push notifications to the mobile version of the trader's terminal.
Notifications are sent in the following cases -
- The EA exits from standby mode, the beginning of the position recovery.
- Completion of recovery, the moment of closing the last part of the position.
In the input settings of the adviser there is a separate section devoted to the selection of notifications
- In order to enable sending notifications by e-mail, you should not only enable the corresponding variable in the adviser, but also make the appropriate settings in the terminal itself. To do this, you need to go through the "Tools" tab in the options menu (Or press Ctrl + O), this menu has an Email control, in which you must already specify the appropriate values. This menu has extensive help when you click on the corresponding button in the window.
- In order to enable alerts, you need to check the corresponding box in the general settings window of the adviser
- In order to configure push notifications, in addition to the installed MetaTrader application, you need to make a couple of settings. To do this, you need to go through the "Tools" tab in the options menu (Or press Ctrl + O), in this menu there is the Notifications tab, in which you already need to specify the appropriate MetaQuotes ID value, taken from your MetaTrader application
8. Additional features. Identifiers and their change.
Advisor identifies orders in two groups, this
- A group of locked orders, that is, all those orders that the adviser will restore and close in parts
- A group of averaging orders, that is, those orders with which the EA will restore orders from a group of locked ones.
Each group has its own identifiers -
- Locked orders are identified by the variable " Group of orders for recovery ", if the values " Manual opened orders of the current symbol " or " Orders of the current symbol with the same Magic Number " are selected, then additional Magic can be added for processing by enabling variable " Use_Additional_Magic " and adding Magic to the variable " Additional_Magic ".
- Averaging orders are regulated by Magic Number and by order comment. When changing the "" variable, the old averaging orders can be sent to the group of locked ones. When using " Allowed types of AWRS orders " = " Without opening " AWRS accepts averaging orders from other advisors or from orders opened using the advisor panel, in the case of the panel, select " Group for opened orders via panel " = " Restorative_group_of_orders ", and in the case of other advisers, you should set up " Magic Number " and " Identifier for recovery orders " so that AWRS perceives these orders as averaging and closes the ones locked with their help.