Averager - Averager for positions. Additional opening by trend and against the trend. Grid

Averager - Averager for positions. Additional opening by trend and against the trend. Grid

25 June 2019, 16:20
Vladislav Andruschenko
17
2 336

AVERAGER


The averaging strategy for forex is well known in general circles. 

Opening the position, you do not have knowledge about where the currency will go in the near future. Even guided indicators or those. analysis. 
The position can immediately go in your direction, increasing profits. 
But there are situations when the price goes against you. There are several options: wait until the price returns to the break-even point, close with minimal losses, or apply the averaging strategy. 
Averaging is the opening of positions against the trend. 
Additional opening or forex forks - when you are replenished with a new position on the trend. This is also very useful. 
Our expert will help you with this.

The strategy of averaging positions is opening an additional position against your main one. Thus, we average the break-even point of two positions. 
The same is done with the refills, but with the trend. 
Next, we'll look at an example:

Suppose you opened a BUY position at a price of 1.600 
The price goes down to 1.500 and the current loss is -100 points 
Break-even point = 1.600 
In order to break even, we need to climb 100 points up. 
If we open BUY position at the price of 1.500, then our position is averaged and the break-even point is 1.550 
Those. in order to get to the point of failure, the price should pass 50 points, not 100. 
The disadvantages of this method of course are: you open an additional lot, which gives a load on the deposit. 
The advantages of this method are unquestionable: you get an opportunity to close before the level you set, but with a profit, and not with a loss.


We open the buy, and our adviser averages our BUY /


Further, the advisor includes the function of the average trailing stop and pulls the total stop-loss of transactions at a price 



As a result, all positions in the BUY direction are closed at one price with the total profit 




An example of how a TickSniper advisor works with the averaging strategy: 


Distance = 100 points, TakeProfit = 250 points, LotsMartin = 2

  1. 1 2013.01.02 09:00 buy 1 0.10 1.32732 0.00000 0.00000 0.00 10000.00
  2. 2 2013.01.02 09:00 modify 1 0.10 1.32732 0.00000 1.32982 0.00 10000.00
  3. 3 2013.01.02 11:27 buy 2 0.20 1.32632 0.00000 0.00000 0.00 10000.00 There are currently no product reviews.
  4. 4 2013.01.02 11:27 modify 1 0.10 1.32732 0.00000 1.32915 0.00 10000.00
  5. 5 2013.01.02 11:27 modify 2 0.20 1.32632 0.00000 1.32915 0.00 10000.00
  6. 6 2013.01.02 12:20 buy 3 0.40 1.32532 0.00000 0.00000 0.00 10000.00 There are currently no product reviews.
  7. 7 2013.01.02 12:20 modify 1 0.10 1.32732 0.00000 1.32839 0.00 10000.00
  8. 8 2013.01.02 12:20 modify 2 0.20 1.32632 0.00000 1.32839 0.00 10000.00
  9. 9 2013.01.02 12:20 modify 3 0.40 1.32532 0.00000 1.32839 0.00 10000.00
  10. 10 2013.01.02 12:27 buy 4 0.80 1.32429 0.00000 0.00000 0.00 10000.00
  11. 11 2013.01.02 12:27 modify 1 0.10 1.32732 0.00000 1.32754 0.00 10000.00
  12. 12 2013.01.02 12:27 modify 2 0.20 1.32632 0.00000 1.32754 0.00 10000.00
  13. 13 2013.01.02 12:27 modify 3 0.40 1.32532 0.00000 1.32754 0.00 10000.00
  14. 14 2013.01.02 12:27 modify 4 0.80 1.32429 0.00000 1.32754 0.00 10000.00
  15. 15 2013.01.02 14:28 t / p 1 0.10 1.32754 0.00000 1.32754 2.20 10002.20
  16. 16 2013.01.02 14:28 t / p 2 0.20 1.32754 0.00000 1.32754 24.40 10026.60
  17. 17 2013.01.02 14:28 t / p 3 0.40 1.32754 0.00000 1.32754 88.80 10115.40
  18. 18 2013.01.02 14:28 t / p 4 0.80 1.32754 0.00000 1.32754 260.00 10375.40

This example shows the opening of the first main position. So, as the price goes to a loss, our adviser opens additional BUY positions. After that, the price returns to the BUY trend and all positions are closed by the common take-profit.

Our averager looks like this on the graph: 


Exp - The mediator is meant for averaging your transactions, which received a certain drawdown and went not in the direction of the trend. 
Our advisor through a predetermined number of points Distance opens a position in the same direction with a lot = Lot previous transactions * LotsMartin and modifies the General TP on all transactions on the price of "zero point line all positions in one direction» + TakeProfit points. 

It is also possible to modify (Trailingstop TrailingStopUSE = true) stoploss of all positions in the direction when the Price broke through the level "The zero point of all positions in the same direction". At a distance of TrailingStop items 

In the Expert Advisor settings, the option is also available - the maximum number of open positions for averaging MaxOrdersOpen 

The adviser will work on the currency pair, on the schedule of which it is installed. Those. To enable the averaging mode on the EURUSD currency pair - you need to open the EURUSD chart - and install the expert. 

Also, you can limit the averaging by the Expert Advisor of the Order types with the OrderToAverage parameter and the Order Magic in the MagikToAverage option 

This Expert Advisor can be tested on the strategy tester in the terminal. To do this, at start-up, 1 BAY position will be opened with lot 0.1 for verification. 

" BUY Average / Lot ", - The number of items before the averaging for BUY positions. It is shown with a minus! + Last item lot 
" SELL Average / Lot ", - The number of points before the averaging for SELL items. It is shown with a minus! + Last item lot 
" BUY Add / Lot ", - Number of points before the refills for BUY positions. It is shown with a plus! + Last item lot 
" SELL Add / Lot ", - Number of points before the averaging for SELL positions. It is shown with a plus! + Last item lot 
" Min Price Buy ", - Minimum price for BUY items 
" Max Price Sell ", - Minimum price for SELL items 
" Min Lot Buy ", - Lot of minimum position BUY 
" Max Lot Sell ", - SELL minimum position item 
" Max Price Buy ", - Maximum price of BUY items 
" Min Price Sell ", - The maximum price of SELL items 
" Max Lot Buy ", - Lot of the maximum position BUY 
" Min Lot Sell " - Lot of the maximum position SELL 
" Average Price Buy ", - Average price, break-even point for all positions BUY 
" Average Price Sell " - Average price, break-even point for all positions SELL 


All parameters depend on the currency pair and your deposit. 
Calculate the distance of the averaging ( Distance) so that when you open the next averaging order, your account contains a sufficient amount of funds. 
For example : I use an averaging distance equal to 75 SPREAD of a currency pair. Those. If your SPREAD currency pair is 10 points, then averaging the distance (Distance) = 750 points. 
Thus, If your position is gaining a distance of 750 points , then my advisor will open an additional position and the break-even point will shift to 750/2 = 375 points from the opening price of the second position. 
This means that the two positions need to go through a distance of 350 points in profit (total profit from two positions) to close at 0 points: The first position will have a loss of 350 points, and the second position will have a profit of 350 points. 
If the positions continue to gain a loss, then the next averaging position will open after 750 points. 
This means that the break-even point will shift to the level of 2250/3 = 750 points. 
In order for three positions to close to a common 0, they need to go 750 points in profit (Total profit).

Why do I use 75 SPREAD ?

This is a sufficient distance (Distance) for averaging. This figure can be applied to any currency pair. 
According to our tests, averaging a distance (Distance) is enough to deposit a sum of $ 1,000 was held for a long time.


Another way to determine the averaging distance (Distance) is to calculate the average movement of the currency pair. For example for 1 week. 
If the currency pair makes a fluctuation for 1 week with a distance of 1000 points, then this means that the probability of passing the price of 1000 points is 100%. 
Thus, you can calculate the averaging distance (Distance) at 1,000 points.

Important is the value at which your deposit will not go to a total loss. 
For example .: 
When you open one position with a lot of 0.01 on the EURUSD currency pair (leverage 1: 100, EURUSD = 1.1961), you need to have a free margin of 11.961 dollars. 
The cost of 1 point = 0.1 dollars. 
If the Distance Distance = 100 points and the Expert Advisor opened 5 averaging positions, then:

Current price = 1.1800

  1. The first BUY position (open price = 1.18500, lot = 0.01) will be at a loss of $ 50.
  2. The second position BUY (open price = 1,18400, lot = 0,01) will be at a loss of $ 40.
  3. The third position BUY (open price = 1,18300, lot = 0,01) will be at a loss of $ 30.
  4. The fourth BUY position (open price = 1.18200, lot = 0.01) will be at a loss of $ 20.
  5. The fifth position BUY (open price = 1.18100, lot = 0.01) will be at a loss of $ 10.
  6. The sixth position BUY (opening price = 1,18000, lot = 0,01) will be at a loss of 0 dollars.

Total: $ 150 + 11.96 * 6 = 221.76. 
This means that to maintain the 6 position (If the averaging distance (Distance) of 100 points) should have the account 221.76 dollars.

Calculate the distance of the averaging ( Distance) independently. It all depends on your deposit and your limits on the loss.


I also recommend setting a StopLoss of 5 averaging distance and not using more than 5 averaging.

For example: If the averaging distance (Distance) = 100 points, while Stoploss (StopLoss) = 500 points, and averaging the maximum number of orders (MaxOrdersOpen) = 5.

All the settings of our utility are familiarized. You must calculate the correct distance for averaging yourself, a lot, a stop-loss.



Name Description
SetMinStops Automatically normalize all parameters of the Expert Advisor to the minimum acceptable stop levels. 
With virtual stops - this parameter has no effect. 
With AutoSetMinLevel, stop levels will be brought to the lowest possible levels allowed on the server; 
With ManualSet, the user will receive a message stating that the levels of stops in the Expert Advisor are less than the minimum and the Expert Advisor will stop trading.
Magic The magic number of the positions opened by our adviser.
TakeProfitALL

Total take-profit for all positions. Takeprofit, which will be exposed to the distance    TakeProfitALL   points from the average price of opening positions

If you set the TakeProfitALL    = 5 points, this means that take profit will be set from the middle line at a distance of 5 points from the middle line.

StopLossALL

Total stop-loss for all positions. Stoploss that will be put up for a distance    StopLossALL   points from the average price of opening positions

If you set the StopLossALL    = 5 points, this means that Stoploss will be set from the middle line at a distance of 5 points from the middle line.

MaxOrdersOpen Maximum number of positions for this pair in 1 direction
AllTradeTrail

Trailingstop / TakeProfitALL / StoplossALL will work and the position that you want to average. 
Those. If your position does not have a Trailingstop / TakeProfitALL / StoplossALL, our advisor will turn Trailingstop / TakeProfitALL / StoplossALL on your position.

This parameter is also involved in the modification of Take Profit / Stop Loss.

If this option is enabled, then all positions on the account will be accepted by our advisor as your transactions. And all deals will be set to take profit and stoploss on the settings of our program.

Include_Commission_Swap

Take into account the author's calculation of the commission and the swap when switching on the functions: Without a break, Trailingstop, Averaging.

The author's calculation of the commission is based on the formula for calculating the value of 1 point from the open positions for this symbol and the magic, A negative swap and commission participate in the calculation. The function returns the cost of the negative swap and commission in points and takes this into account when the break-even and trailing stop functions are running.

Attention : If you have a floating spread on your broker, the settlement of the commission is executed and set at the moment of the breakeven and trailing stop function, but the spread may increase, which will incur additional loss points. This is not a calculation error!

Also it is worth considering that when a swap occurs, the EA recounts the break-even line and establishes new stop-loss if the server allows it. (Restriction to the minimum stop level for your StopLevel broker). If the server does not allow to set a breakeven and returns a minimum stop level error, the EA will not be able to modify the position and you can receive additional loss items.

In order to avoid receiving a loss when using a commission with a commission and when receiving a negative swap, we recommend that you increase the distance of the lossless or trailing stop.

The level of loss-free (  LevelWLoss ) can be calculated independently, given the commission.

for example: Commission for opening and closing a position = 2 dollars (EURUSD) per 1 lot. So, in order to cover the loss on the commission, you need to set  LevelWLoss = 2 (points) +1 (control) = 3 points.

Thus: the adviser will establish a break-even by +3 points, which in turn will cover the loss on the commission.



Distance The station of the open positions of the averaging grid. 
After how many points against the trend, open the next averaging position
DistanceMartin the increase factor is the distance from the average for each subsequent transaction. 
You can set 50 points, then each new averaging position will be opened through 100 +50 loss points from the last open position. (100,150,200,250,300)
DistanceAdditionalPoint

Additional points for calculating the distance. 
If DistanceAdditionalPoint = 5, then 5 points are added to each following distance.

If the previous orders = 3, then additional points for the distance = 5 * 3 = 15 additional items

DistanceMax The maximum number of points in the distance. 
If, when calculating the distance, the obtained value is higher than DistanceMax, then the Expert Advisor takes the value DistanceMax.
DistanceDifferent DistanceDifferent : Distance of new positions of averaging (against the trend) ,
separated by commas!
You can specify distance values in the format xx, yy, zz, aa
Where:
xx - Distance in points for opening the first position of averaging;
yy - distance in points for opening the second position of averaging ;
zz - Distance in points for opening the third position of averaging ;
aa - Distance in points for opening the fourth and other positions of averaging ;
You can set any number of distances.
StopLoss

Stoploss of the averaging position to be opened, 
Note: Each individual averaging position will initially open with its stop-loss

Stoploss that will be put up for a distance    StopLoss   points from the opening price of the averaging position;

TakeProfit

Take-profit of the opening position of averaging, 
Note: Each individual averaging position will initially open with its TakeProfit

Takeprofit, which will be exposed to the distance    TakeProfit   points from the opening price of the averaging position;

LotsMartin Increase the lot for the grid positions. The coefficient of increase of each averaging position. 
For example: 
Starting lot of the main position = 0.1 
LotsMartin = 2, then 
The next lot of the opened averaging position will be 0.2, 0.4, 0.8 and so on. 
Attention: The middle line will be calculated using the formula using lots. 
Allows you to bring the break-even level (middle line) closer to the current price. 
But martingale can be dangerous to your account. Please, calculate this parameter so that your deposit will withstand such a load
LotAdditional additional lot for the averaged position. 
For example: 
Starting lot of the main position = 0.1 
LotAdditional = 0.05, then 
The next lot of the opened averaging position will be 0.15, 0.2, 0.25 and so on.
LotDifferent 

Lots, separated by commas for averaging;

You can specify the desired values of lots in format: xx.xx,yy.yy,zz.zz,aa.aa 
where: 
xx.xx - Lot to open the first averaging position; 
yy.yy - Lot to open the second averaging position; 
zz.zz - Lot to open the third averaging position; 
aa.aa - Lot to open the fourth and averaging the remaining positions; 
You can specify any number of lots. 

LotMax The maximum lot that will be displayed when the averaging position is opened. 0 - disconnected
CloseAveragingAfterCloseMainDeals  Close averaging positions (open against the trend) when the main positions are closed.
The function will close the averaging positions only when all the main positions (according to the current symbol and magic number) are closed!
Attention: The new function works separately for the BUY and SELL directions!


ADDITIONALDistance the distance of the open grid positions for an additional trend opening.
ADDITIONALDistanceMartin The coefficient of multiplying the distance for an additional trend opening.
ADDITIONALDistanceAdditionalPoint

Additional points for calculating the distance. 
If    ADDITIONALDistanceAdditionalPoint = 5, then to each following distance is added 5 points.

If the previous orders = 3, then additional points for the distance = 5 * 3 = 15 additional items

ADDITIONALDistanceMax The maximum number of points in the distance. 
If the distance is calculated, the value obtained is higher than    ADDITIONALDistanceMax , then the Expert Advisor takes the value    ADDITIONALDistanceMax .
ADDITIONALDistanceDifferent  ADDITIONALDistanceDifferent: Distance of new positions of additional opening (to the trend),
separated by commas!
You can specify distance values in the format xx, yy, zz, aa
Where:
xx - Distance in points for opening the first position of  additional opening;
yy - distance in points for opening the second position of  additional opening;
zz - Distance in points for opening the third position of  additional opening;
aa - Distance in points for opening the fourth and other positions of  additional opening;
You can set any number of distances.
ADDITIONALStopLoss

Stoploss of an open position for an additional opening on a trend.

Stoploss, which will be exposed at a distance of ADDITIONALStopLoss points from the opening price of the additional position 
discoveries;

ADDITIONALTakeProfit

Take-profit of the open position for additional opening on the trend.

Takeprofit, which will be set at a distance ADDITIONALTakeProfit points from the opening price of the additional position 
discoveries;

ADDITIONALLotsMartin Increase the lot for a grid of positions for an additional trend opening.
ADDITIONALLotAdditional An additional lot for an additional position for an additional trend opening.
ADDITIONALLotDifferent 

Lots, separated by commas for additional trend opening;

You can specify the desired values of lots in format: xx.xx,yy.yy,zz.zz,aa.aa 
where: 
xx.xx - Lot to open the first additional trend opening position; 
yy.yy - Lot to open the second additional trend opening position; 
zz.zz - Lot to open the third additional trend opening position; 
aa.aa - Lot to open the fourth and additional trend opening the remaining positions; 
You can specify any number of lots. 

ADDITIONALLotMax The maximum lot that will be displayed when the averaging position is opened. 0 - disconnected
CloseAdditionalAfterCloseMainDeals  Close additional open positions (opened with the trend) when the main positions were closed.
The function will close the position of the additional opening only when all the main positions (according to the current symbol and magic number) are closed!
Attention: The new function works separately for the BUY and SELL directions!


OrderToAverage The order type for the Expert Advisor
MagikToAverage

The magic number of the positions on which the averaging strategies will be applied!

Added multi magic:
      MagicNumber Magic number of positions (transactions) for tracking and accounting.
      MagicNumber Magic numbers can be specified separated by commas:

  1. 0 - orders opened manually;
  2. 123,345,147 - all positions with MagicNumber numbers 123,345,147;
  3. -1 - all MagicNumber, without exception.


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.
SleepForOpenbetweenLastClose The number of seconds of the averaging delay, after the last closed position
OpenOnly1ofBar open only one averaging position \ additions at 1 current bar (Depends on TF)


TrailingStopUSE Function of standard trailing stop function. 
Note: If the averaging or refilling function is enabled, if you open 2 or more positions, the Expert Advisor turns on the trailing stop function from the middle line, and not from the open position price

TrailingStop Distance trailing stop in points
TrailingStep Step of stop loss at trailing point in points


MovingInWLUSE Enable the breakless function for open positions. 
Attention: If the averaging or refilling function is turned on, then when you open 2 or more positions, the advisor includes a break-even function from the middle line, and not from the opening price of positions
LevelWLoss The level of profit in points on which the Stop Loss is set when this function is enabled
LevelProfit The number of profit items gained by the position for setting a  stop-loss in the  LevelWLoss of profit items






Share it with friends: