"The greatest fortification of the fortress is its defenders ...."
How often do you refuse more important things than look at the quotes charts?
Probably every 2nd reader has been in a situation where, in anticipation of the continuation of the trend is removed StopLoss in the hope that this position will bring you more profit than you expected. From this I wanted to start my article.
The market is very unpredictable, and hoping for some strategy or adviser is quite dangerous. The vastness of the Internet is teeming with a diverse kind of advisers, whose authors yaro assure you that the working strategy and this adviser will bring you profit. Quite often, such advisers sooner or later miss their calculations and you risk losing your money. Working with positions, some traders insure their positions with the help of lock (HEDGE) orders, oppositely directed positions.
But often Lock is not an option, but a temporary satisfaction of one's desires.
It helps traders avoid a strong market turn by placing an opposite pending order for an already open position.
If a trader or adviser opens a position, our defender opens a deferred opposite order to this position. If the trader's position goes to a loss, the pending protective order triggers, thereby creating a LOCK lock.
In the functions of the Expert Advisor, it is possible to close the original position or work with the trailing stop, multiply the lot.
There is also a function to modify the price of opening a pending order following the price of the position.
The advisor starts his work by checking all open positions for the presence of already placed pending orders. In the system there are settings for the items being checked:
SymbolToMonitor - The name of the instrument behind which the positions should be monitored. This option is designed to restrict the expert from working on certain symbols. For example, if you want the system to keep track of the positions of a particular symbol, you must replace this parameter with the exact name of the instrument (for example: EURUSD USDCHF USDRUR). If you want an advisor to follow all positions, including positions that have been opened manually, this parameter should be set to 0
A pending order can be set with, set in parameters, StopLoss and TakeProfit.
Also, a pending order can be set with a lot multiplied by MNLot. For example: if the position is open with lot 0.5, and the parameter MNLot = 2, then the pending order will be opened with lot 1.0.
Further, the system Exp - SafetyLock PRO checks already open pending orders, and if the price has left the order for a distance of sens, then the system modifies the pending order, thereby tightening the order after the price.
If the main position is closed (by stop-loss, take-profit, manual or another system) - the pending order placed on this position is also deleted.
Parameter OrderSafetyMonitor - regulates the ability to check the issued orders. In other words, this parameter allows (true) / disables (false) the setting of pending orders at positions that were opened by the system Exp - SafetyLock PRO .
Sometimes there is a need to include trailing stop on positions. And since we started talking about an automatic system, I "screwed" to this system automatic Trailingstop.
In order to enable the Automatic trailing stop, the parameter TrailingIfProfit should be set to true. It should be noted that when this function is running, the parameters StopLoss and TakeProfit at the first operation of the function are modified to 0.
Parameter TrailingStop - means the trailing stop.
Parameter Prchoose - Profit in the points at which the automatic trailing stop will begin its work.
Conclusion: With certain settings and subsequent verification of the system, I found that this tool is a kind of gold dwelling for all systems that are available on the Internet. This tool can rightly claim the title of "Full-fledged system defender". But it is worth taking into account the fact that the market is unpredictable and no one, even the most experienced traders can not with 100% confidence give the analysis of the market.
The system monitors open orders for all currency pairs or for those specified in the Advisor settings, the parameter Symbol_Monitor .
The system follows those positions that are exposed in the adviser Type_Monitor
The system follows those magic numbers that are displayed in the advisor Magic_Monitor
A pending order is placed with a stop order for a distance StopOrderDeltaifUSE of the current price.
Further, the Pending Order is monitored.
If we have passed the distance StopOrderDeltaifUSE from the order and the parameter ModifyOrdPend = true, the price of the Pending order is tightened. Thus leaving in breakeven.
As soon as the pending order has triggered, we begin to follow it (watch out for it).
The system has the function of disabling the monitoring of their orders. parameter SafetyPosMonitor = false disables monitoring of the positions that were created by this Expert Advisor.
If you set the parameter to true, the system will monitor its pending orders.
Further, if the Pending Order does not work and the warrant from which the Pending Order was opened is already closed by the user or in another way - The pending order placed on this order is automatically deleted.
In the system there is an opportunity to multiply the lots of the Pending order. parameter MNLOT . If, for example, an order is opened with lot 0.2 then the Pending order will be opened with lot 0.2 * MNLOT.
If the CloseOneifStopsActive = true, the position on which the Pending Order was opened is closed and only the position created by this Expert Advisor will remain in the work
Also in the system there is an opportunity to expose StopLoss and TakeProfit pending orders
It is possible to include a trailing stop on the position Tralling .
When the terminal is restarted, the system does not expose the new Pending orders. It monitors the Pending orders placed earlier.
|MilliSecondsTimerForMonitoring||number of milliseconds of execution of the algorithm (default 1000 = 1 second)|
|SymbolMonitoring||SymbolMonitoring = ALL_SYMBOL = Check all symbols, all transactions on the account. If you installed an advisor on a chart of any currency pair, he will monitor all currency pairs on the account;
SymbolMonitoring = ONLY_CURRENT_SYMBOL = Check only the current character. The advisor will only inspect and accompany transactions with the symbol on which the expert is installed;
SymbolMonitoring = SPECIFID_SYMBOL = Check only transactions as specified in the SPECIFID_Symbol_Monitor symbol. For example EURUSD - then the adviser will accompany transactions only on the symbol EURUSD;
|SPECIFID_Symbol_Monitoring||Added the ability to create a list of characters separated by commas, for monitoring.
You can specify symbols for monitoring:
SymbolMonitoring = SPECIFID_SYMBOL SPECIFID_Symbol_Monitoring = EURUSD, USDCHF, USDJPY
then the adviser will follow 3 pairs
|Type_Monitoring||type of transactions for monitoring, BUY SELL or ALL|
|Magic_Monitoring||Magic number of items for monitoring
Now you can specify a list of magic numbers separated by commas, which you need to Check.
Magic_Monitoring = -1 means that they will check all magic numbers;
Magic_Monitoring = 0 means that manual transactions will be monitored;
Magic_Monitoring = 555,777 means that wizards 555 and 777 will be monitored;
|Comment_Monitoring||This option filters transactions for placing LOCK on positions whose comments coincide with Comment_Monitoring
Comment_Monitoring = "" - monitors all transactions, no matter what their comment
Comment_Monitoring = "VirtualTRadePad" - monitors all transactions, with the comment of VirtualTRadePad, even if the comment has VirtualTRadePad-1 or VirtualTRadePadEXTRA or TickVirtualTRadePadEXTRA
|Min_Lot_Monitoring||The minimum lot for monitoring by the adviser, if 0 - the parameter is disabled;|
|Max_Lot_Monitoring||The maximum lot for monitoring by the adviser, if 0 - the parameter is disabled;
for example, you need to use the current SafetyLock advisor to protect positions that have gained a large lot, for example when using martin. Lot, on which you need to set the opposite stop order = 0.16, and the advisor should not touch positions that are less than 0.16, then you need to set the following parameters: Min_Lot_Monitoring = 0.16;
for example, you need to lock all positions that have a lot from 0.1 to 0.25, then you need to set the following parameters:
Min_Lot_Monitoring = 0.1;
Max_Lot_Monitoring = 0.25;
|SafetyPosMonitoring||Enable monitoring of the positions opened by the SafetyLock advisor.
If SafetyLock has locked your position by placing a pending order and this pending order was activated and turned into a position, then SafetyLock will install a new pending order for this position.
This algorithm is similar to the Swing algorithm.
|StopLosse||StopLock Orders of Pending Orders SafetyLock|
|TakeProfite||Safety of the orders of pending orders|
|MNLOT||Lot multiplier for pending orders
If, for example, the order is opened with lot 0.2, then the pending order will be opened with lot 0.2 * MNLOT ;
|StopOrderDeltaifUSEe||Distance for pending orders SafetyLock|
|NumberofStopOrder||The number of pending orders SafetyLock for one position.
You can set NumberofStopOrder = 5, then 5 pending LOCK orders will be opened for each position.
Allows you to build a grid of pending orders
|DistancefromStopOrders||The grid spacing in points, when using NumberofStopOrder|
|ModifyOrdPend||Include a modification of the opening price of pending orders when the price moves.
Lets stretch pending orders after the price.
|ModifyOrdPend_STEP||Step of modification in points|
true - the ability to change a pending order only up to the opening price of the position (old version)
false - continue to modify the opening price of pending orders by price movement
|ReopenClosedSafetyOrders||Allows you to reopen the SafetyLock pending orders if they were closed with a stop, while the protected position is still open.
For example: Pending order SafetyLock has worked and turned into a position, this position is set stoploss, takeprofit or trailing stop. This position, when the price moves, is closed by its Stoploss or TakeProfit. When this option is enabled, the SafetyLock advisor will issue a new pending order to the main position.
|StopOrderDeltaifReopens||The distance to set the pending order SAFETYLOCK after reopening the order.
If StopOrderDeltaifReopens = 0, then the distance = StopOrderDeltaifUSEe (old version)
The price for setting a pending order will be calculated from the current price.
closes the original position if the SafetyLock position has been closed in profits that cover the current loss of the original position.
When using NumberofStopOrder> 1, the profit of SafetyLock positions is calculated from the amount of profit of all positions in the Ticket of the main position.
Now the closing of the main position occurs only when the amount of profit of the closed positions SAFETYLOCK and the main position is greater or
For example :
closes the original position if the SafetyLock position is more profitable, overlapping the current loss of the original position.
When using NumberofStopOrder> 1, the profit of SafetyLock positions is calculated from the amount of the profit of all positions according to the ticket of the main position.
Now the closing of the main position and positions of SAFETYLOCK occurs only when the amount of profit of these positions is greater or equal
For example :
If both Close_One_if_Safety_More_profitable and Close_One_if_Safety_Closed_In_Profit functions are enabled ,
For example :
|CloseOneifStopsActive||Close the position if the SafetyLock pending order has triggered.
If the pending order is activated and turned into a position, then, if this option is enabled, the main position will be closed.
|CloseSafetyPositionsifclosed||Close SafetyLock positions, which are already activated if the main position is closed.
If the main position has been closed, then the SafetyLock position will also be closed
|Close_One_if _Safety_Closed||If the position SAFETYLOCK was closed for any reason (manual close, takeprofit, trailing stop), then the main position will also be closed.|
|Remove_TAKEPROFIT_ofOriginalifStopsActive||Delete the take-profit of the original position if the SafetyLock pending order has been activated;|
|Remove_STOPLOSS_ofOriginalifStopsActive||Delete StopLoss of the original position if the SafetyLock pending order has been activated;
Allows you to "hard" fix LOCK on two positions while deleting stop loss and takeprofit. Creates a "Safe Lock", which will not be unlocked if the original position was closed by its ststoloss or takeprofit.
|TrailingStopUSE||Enable trailing stop positions SAFETYLOCK PRO.
Includes trailing stop on positions that have been activated and opened by an advisor
|IfProfTrail||Include trailing stop only when the position is typed TrailingStope points of profit.
If you turn this option off, the EA will turn on the trailing stop function immediately, as soon as the position reaches +0 profit points. Then the first stop-loss will be established in the negative zone.
|TrailingStarte||Number of profit points to start the trailing stop function|
|TrailingStope||Distance in points from the current price to the established stop-loss.
If the current profit is 200 points, and TrailingStope = 100, then the stop-loss will be set at +100 points. Thus, we give the price the possibility of a rollback of 100 points maximum. In the other case stop-loss will work and the position will be closed at +100 points.
|TrailingStep||Step of stop loss when the trailing stop function is enabled.|
|MovingInWLUSE||Enable the break-even function.
The function modifies the stop loss in LevelWLoss points when the position dials the LevelProfit of the profit items.
LevelWLoss = 50 LevelProfit = 200
As soon as the position accumulates 200 points of profit, StopLoss of the position will be modified to the opening price of the position (+ spread) + 50 points
LevelWLoss = 0 LevelProfit = 100
As soon as the position accumulates 100 points of profit, StopLoss of the position will be modified to the opening price of the position (+ spread)
|LevelWLoss||The level of stop-loss in the positive zone in points|
|LevelProfit||The number of points of profit that a position must pass for the lossless function to modify the stop-loss.|
|SetMinStops||Automatically normalizes all parameters in points to the lowest possible level of stops on the server.
If YOU specified stop loss or distance = 10 points, and the minimum stop level on your server = 20 points, then the Expert Advisor automatically normalizes stop loss and distance values to 20 points.
If you turn this option off, then when the server returns error 130, the Expert Advisor can not install a pending order or stop-loss
|Magic||The magic number of opened pending orders by the adviser|
|Slippage||The level of maximum possible slippage in points when opening and closing positions.
Slippage = 1
Maximum deviation when opening a position = Opening price + -1 point.
Slippage = 100
Maximum deviation when opening a position = Opening price + -100 point.
For example: The price of opening a position when sending an order to the server = 1.12345
But, if during the time of sending and opening a position the price has changed within 100 points, then the position will open with a slip in the range of 1.12245 - 1.12445
|MarketWatch||It includes the ability to open positions with stop-loss / take-profit on an account with MARKET execution.
The first opens the position, after the successful opening, the levels of StopLoss and TakeProfit are modified.
Safety SLP - Leveling of positions.
Smoothing losses by overlapping plus orders.