![Recommendations for Open Lock advisor setup and usage Recommendations for Open Lock advisor setup and usage](https://c.mql5.com/6/792/splash-713373.jpg)
![Sergey Likho Sergey Likho](https://c.mql5.com/avatar/2022/6/62A1BDA2-1D02.jpg)
The main goal of the advisor is to reduce or completely close the loss on the account.
To begin work, one or more transactions must be already opened.
Algorithm
When started, the advisor searches for profitable transactions and at their expense it tries to close a part of failing orders.
If loss-making orders remain, Advisor will open additional transactions in such a way that the number of lots per buy could be equal to a number of lots per sell (this is called locking). In this situation, wherever the price goes, the size of the loss will not increase.
Transactions that are open for locking are marked with a locking comment.
Then Advisor finds a long failing transaction deal, and cventionally divides it into several small parts. (for example, a order with 1.0 lot will be divided into 10 transactions 0.1 lot each)
In the future, each of these small transactions will be closed separately.
With partial closing of transactions, the risk is significantly lower than with the classic making up for the whole item.
How to open new orders
Advisor opens orders through a certain number of points specified in the options. A new order is opened if the previous one is at a loss.
These items are marked with an average comment and are opened with a magic number specified in the options.
In the future, Advisor considers these orders "its own ones".
Each new order is opened by a lot indicated in the options times the factor.
How to
close orders
New orders are opened with a small amount. When the profit with these orders exceeds the size of the loss part, the closure occurs.
With standard settings, loss-making buys are closed at the expense of new buys. It is similar with sale transactions.
For example: a loss-making order was opened by lot 1.0 with a loss of -$1,000
In Advisor settings, we specify the part we want to close: 0.1 lot (i.e. 1/10 of the loss-making order).
In the same way we specify profit that we want to receive from such a close: $15.
To close the transactions, the account should receive a profit of $1,000 * 1/10 + $15 = $115.
When this profit is achieved, Advisor closes its orders and a part of the losing transaction.
After the transaction part is closed, we have a profit of +15$ and a loss-making order of 0.9 lot remains.
This is a very simple example. In real trade, the situation changes constantly. Advisor keeps its track at every price change.
How to prepare an account before running Advisor
You do not have to do that, but it will help Advisor handling a drawdown quicker.
If there are many transactions opened at different levels and in different directions, then before starting Advisor, you can manually close all the profitable ones, and close the loss-making ones in the volume of profit received.
1. This approach will reduce the number of lots. It will also reduce a swap charge.
2. There will be fewer transactions and lots, then Advisor will quickly cope with the drawdown.
The work principle is shown at this page (RUS): https://likho.ru/kak-sokratit-lotyi-v-zalokirovannyih-sdelkah-chema/
When Advisor should be used
- When an account has a drawdown of 5% or more;
- When rhere are a lot of buy and sell transactions;
- When a lot in transactions can be divided in parts
- When there are funds available in an account has, which Advisor can use to open its items.
When Advisor should not be used
- When the drawdown size is extremely small
For example: a deposit is $3,000 and one transaction is opened with 0.01 lot and a loss of -15$. In this case, the Expert Advisor should not be started.
How Advisor tells its transactions from others
When Advisor is started, the magic number is specified in the options.
Advisor considers transactions opened with this magic its own. All the rest are others’.
To close loss-making orders, Advisor uses profit only from its transactions.
Important!
If Advisor opened transactions with its magic number, and then you change the number, Advisor locks the previous orders as it thinks they are others’.
How options impact Advisor’s work
A lot in new transactions
The higher a lot size, the faster a loss-making order will be closed. It should be borne in mind that several orders can be opened and if the price runs against them, then an additional loss will be accumulated.
Lot multiplier
The higher it is, the larger lot will open new transactions. This will also allow faster closure of losing transactions, but on the other hand it may lead to losses.
Step
This is a distance between new orders. The smaller it is, the more often new orders will be opened. Reducing a step also leads to faster closing of loss-making orders. On the other hand, with a strong price movement, many orders can be opened for which an additional loss will be accumulated.
Step multiplier
It allows you increasing the distance between new orders.
When the factor activated, the distance between new orders will change constantly. For example: step 100 and factor 1.2, then the first step = 100 points, the second = 120, the third = 144.
Activating the factor makes it possible to carry large price movements in one direction safely.
Direction
Originally, the direction is set as UP / DOWN.
This indicates that Advisor trades both upwards and downwards. That is, Advisor will open buy and sell transactions.
The profit on buy transactions will be used to close loss-making buys.
The profit on sell transactions will be used to close loss-making sells.
If buy transactions are in profit, then new orders will not be opened. It is similar for sells.
When the UP/DOWN mode is on, Advisor will quickly win transactions back on the lateral market.
In UP or DOWN mode, Advisor will only open transactions in one direction.
In UP mode - only buy, in DOWN - only sell.
In this case, the price-furthest transaction will be played, whether it is a buy or a sell.
Such a mode is needed to adjust Advisor to work by trend.
A correct tuning of the robot to the market allows 2-3 times reduction of time for closing loss-making orders.
It is important to consider that if a long losing transaction is opposite to «direction», then a lot in new orders should be higher than a lot being closed.
For example: the direction is UP, and the long losing transaction is a sell 0.1 lot. Advisor will open buy transactions to close the loss-making sell. The "new lot" option must be at least 0.11 and 0.2 and higher is better.
Lot when closing an order
If we put a big lot, the losing transaction will close faster, but to close it we will need to accumulate more profit.
If you put a small lot, then the closure will be more secure.
Profit when closing
The size of the profit that must be received when closing losing orders. This parameter is needed to insure the account against possible drawdonws and requotes, as well as to get a small profit from the trade. The higher this parameter, the more profit will need to be collected according to Advisor’s orders.
Additional profit when using Advisor
If locking is enabled and one of the trade directions is in profit, the advisor will receive additional revenue when leveling the lock.
How it happens:
For example, a 1.0 buy and a 1.0 sell transactions are opened. Buy is in profit, sell is at a loss.
On Advisor’s orders, the profit is accumulated which closes 0.1 lot of the deal. As a result, we still have a 0.9 lot. Then Advisor will level the lock and close 0.1 lot from the profitable buy. In this way, additional profit will be obtained.
If the both types of transactions are losing
The buy and sell results can be losing if the price is inside the lock. Then the weighted average buying price is higher than the current price. The weighted average selling price is lower than the current price.
In this case, Advisor will not be able to obtain additional profit.
Instead, Advisor will try to bring the weighted average price closer to the market price, so that one of the losing directions may becomes profitable.
Options
recommended for trading
Situations with an account can be different and therefore in each case you need to select the optimal settings for yourself.
There are no universal options suitable for any situation.
When choosing options you should consider:
- Financial tool with a drawdown;
- The size of the deposit, the size of the drawdown, the size of available funds;
- The number of open orders and the number of lots;
- Stop Out Level;
- The leverage size;
There are basic rules that I recommend to keep to when setting up Advisor
With aggressive trading and a drawdown rate of up to 10%
Lot of new orders: 1/4 of the lot for a long loss-making transaction (If the lot is in a loss-making transaction is 1.0, then the parameter is 0.25)
Factor per lot: 1.3
Step: 1/4 of the average daily volatility by a financial tool. (the volatility can be identified by the ATR indicator (24) added at timeframe D1.
For EURUSD and GBPUSD, we can assume that the volatility per day is 1,000 points (for a 5-digit) quotation.
Factor per step: 1.0
The lot for closing is the same as the lot for new orders
Profit: 50 points opened by a new lot. (for example, a lot for new transactions is 0.1, then the profit should be set at $5)
With conservative trading or a high drawdown
Lot of new orders: 1/8 of the lot for a long losing trade (If the losing transaction lot is 1.0, then the parameter is 0.12)
Factor per lot: 1.2
Step: 1/2 of the daily average volatility by a financial tool.
Factor per step: 1.2
The lot for closing is the same as the lot for new orders
Profit: 10 points opened by a new lot. (for 0.1 of the lot, it is $1)
You can take my recommendations into account when setting up Advisor.
If there are any doubts about the correctness of the selected parameters, you can always consult the author.
A good tool for selecting parameters is the strategy tester.
Try to find a period in history similar to the current one and test Advisor with different options on it. In the tester you can prohibit Advisor trading (the large button on the control panel). Then open transactions at the necessary price levels, and then turn on the robot and see how it will cope with the loss.
How long is a drawdown closed
It depends on the parameters exposed and market volatility.
A drawdown of 5% with conservative settings can be closed in 5-10 trading days.
When to disable Advisor
When the drawdown size for the account is zero, or when it is too small.
It is not necessary to let Advisor close all losing transactions.
A situation may occur when the loss size is so small, and the resources for closing it are too large. (For example, when 0.01 lot is closed by transactions with a total volume of 0.5 lot). In this case, it is better to simply close the small minus manually.
How to use Advisor safely and efficiently
Here are some recommendations:
- Use a big step and a small initial lot.
- Always use factors.
- Tune Advisor to work by trend.
- Do not run Advisor for minor drawdowns.
- In Advisor settings, limit the maximum drawdown to which you agree with. Upon reaching the drawdown, Advisor either locks all transactions or fixes the loss.
- If the drawdown is on several financial tools, it is recommended to use Advisor first on one tool, then to switch to the next one. To prevent other financial tools from causing a loss, you can lock transactions on them manually. Parallel running Advisor on several tools increases the load on the deposit.
- In the latest versions, you can prohibit Advisor to trade. (Close Only mode) Next, to open orders you should use another robot with a more efficient algorithm. (Advisor should open transactions with a magic number the same as with OL).will consider those transactions its own and the profit on them will be used to partially close the losses.
- Use a large leverage, this will reduce the amount of collateral and increase the amount of available funds.
- Use accounts in which a deposit is not charged if there are counter transactions
- Use accounts in which you can open a large number of orders
- Use accounts with a low Stop Out level.
- Turn Advisor off when important news is released
If the drawdown is too big and Advisor cannot
cope with it
To work Advisor needs a stock of available funds. This should be taken into account when selecting parameters.
If the amount of available funds is too small, a critical situation may occur.
What can be done in this case:
- If the amount of available funds is sufficient, you can lock all transactions and start closing the drawdown from the very beginning. But in this case you will need to make more conservative settings or to replenish the deposit.
- If the amount of funds is small, you can close some or all of the profitable transactions and reduce the loss by the profit size. In this way, you will reduce the amount of a collateral. Then you should lock the items and restart Advisor.
To lock previously opened orders, it is enough to change the magic number in the Expert Advisor settings and restart the Expert Advisor.
Important!
Locking previous orders can significantly load the deposit of additional transactions. This should be done only in the most extreme cases.
How to help the work of Advisor
If you have confidence in your abilities, you can help the work of Advisor by opening additional orders manually. Open a transaction with a script (attached to this article). For correct operation, it is necessary that the terminal settings allow trading.
It is important that the magic number coincides with what is specified in the robot settings.
What you should know about trade in
one direction
Do not change the direction of trade too often (Direction option)
Consider the example: Advisor opened buy and sell transactions.
Then the user changes the direction to UP only, i.e. then only buys will be opened.
The account will still have sell transactions, which were opened earlier.
Advisor will close these transactions only when the profit on them will be positive.
If there is no profit on them, these transactions will remain in the market.
Then, after closing the main loss, you should restart Advisor with another magic number, so that it could close these transactions.
How else
you can use Advisor
Suppose you do not have orders. Then you open any transaction and immediately run Advisor with the locking enabled. At the same time, the transaction will be locked. One transaction will generate profit and Advisor will slowly close it. And the losing direction will be compensated by Advisor.
Using Open Lock with other Advisors
You can use other advisors in parallel with OL in two cases:
- if the Close Only mode is enabled
- if locking is disabled.
In other cases, simultaneous work will lead to conflicts.
Advisor can be configured so that when a drawdown is achieved, it will disconnect another robot and start work itself.
You can use other advisors on several financial tools. But it's important to consider the amount of available funds.
Can I
run several Open Lock advisors together
Not for one currency pair.
It is possible on different currency pairs only if there are enough available funds.
If the funds are small, it is better to reduce the drawdown on different financial tools sequentially.
What will happen if you change the settings of
Advisor in the process of work
If Advisor trades, and you decide to change the settings in the control panel, then there may be a situation where you need to close or open additional orders.
Example:
In the settings, a step of 1000 points is specified.
Advisor opened an order, which went to the minus by 700 points (the next order should be opened after 300 points).
Then the user sets the step of 500 points. In this case, Advisor must immediately open a new order. But it will not do it.
Advisor has a built-in protection against such situations.
When changing the options, the robot checks whether they lead to opening or closing orders. If you want to open or close orders, Advisor stops its work, and shows information on the panel about what actions will occur when you turn it on.
What else you need to know about the work
of Advisor with orders
You should not interfere in the work of the robot.
Advisor constantly keeps all open transactions under control.
The manual closing of an order slightly disorients Advisor and each time it will try to correct the situation.
If you close sell or buy transactions with which Advisor works, it will immediately try to open this transaction again.
If you close Advisor's transactions, you will lose some of profits that could be used to close the loss. Then Advisor will need more time to close the drawdown.
If the last transaction of Advisor is closed, then, if there are conditions for that, Advisor will reopen it.
Advisor deletes TP and SL in all orders. Advisor itself decides when to close a transaction, and stop orders may disturb its work.
Successful trade for you and good luck!
Sincerely, Sergey Likho