Algorithm of operation:

When running the Expert Advisor, it will place two orders: in other words, it will create the first grid of orders, which lot size is increased in accordance with a “K_Lot”, and a distance between these orders is equal to the value of “Step” parameter.

Assume that the price is making pullbackless movements. The number of orders, which can be opened within the grid, has been limited by “MaxOrders”. As soon as the limit is reached, the Expert Advisor will open the second grid of orders in the same direction and with an initial lot size.

At that, a grid of orders opened in the opposite direction will not be closed, and the sum of lots of its open orders depends from a number of grids of the opposite open orders. The larger is their number, the higher is a lot (it is determined by “K_2_Lot” coefficient) of a grid of orders opened in the trend direction.

If there are more than two grids of orders opened in one direction, then every grid is, so to say, averaged by a subsequent grid. So, the Expert Advisor treats the whole grid as a separate position.

```extern int Step = 10; //расстояние между открываемыми ордерами в сетке ордеров extern double FixLot = 0.01; //фиксированный лот extern double LotPercent = 0.01; //рассчет лота как процент от депо extern double K_Lot = 1.7; //умножение лота extern double K_2_Lot = 1.2; //умножение лота противоположной сети если основная вошла переоткрылась extern int Takeprofit = 40; //тейкпрофит extern double PercentClose = 0.1; //закрывать все ордера при получении профита в проценте от депозита extern int MaxOrders = 14; //максимальное кол-во ордеров одной сети extern int slippage = 30; //проскальзывание extern int Magic = 1000; //уникальный номер ордеров extern int DigitsLot = 2; //округление лота (2 - 0,01) (1 - 0,1)```