The EA has no pending orders, all positions are opened at the current market price.
There are many modes of operation of this network, its main difference from others is the automatic detection of the step and size of the network (with appropriate parameters)
Approximate job description:
The price goes up, we put Buy, turned around and passed half the grid step, we put Sell.
As a result, a grid of orders is created in different directions.
There are dozens of options for closing, I can’t list everything, but I think we’ll figure it out in the process.
Magic Buy and Sell orders are placed separately.
This is so that the Expert Advisor can count the ProfitClose closing profit on Buy and on Sell separately.
As soon as the profit of a particular direction of orders reaches ProfitClose in the deposit currency, all orders of this direction will be closed.
If you set the same Magic, then the ProfitClose closing profit will be counted for all orders.
As soon as the total profit reaches ProfitClose in the deposit currency, all orders will be closed.
Buy = true; //allow Buy transactions
Sell = true; //allow Sell transactions
MagicBuy = 888; //unique order number of this EA for Buy orders
MagicSell = 777; //unique order number of this EA for Sell orders
StepBuy = 0, //if 0, then by the maximum candle size of the last 100 (N_Candle_Step)
StepSell = 0, //if 0, then by the maximum candle size of the last 100 (N_Candle_Step)
TF_Candle_Step = 0, //candle time frame, if 0, then the current
N_Candle_Step = 100,
Stoploss = 0;
LossPlusProfit = true; //add the resulting loss from the loss to the closing profit
ProfitMinusProfit = true; //subtract the received profit from the TP from the closing profit
Takeprofit = 0;
level_of_zero = true; //include the trailing and breakeven from the total breakeven level
TrailingStop = 0, //if -1, then trall = grid step
MinProfitNoLoss= 0, //minimum profit when transferring to a loss
NoLossBuy = 0, //transfer to breakeven
NoLossSell = 0, //transfer to breakeven
D_NoLoss_B = 10, //Shows how many points after the first Buy order, the NoLoss function will start operating
D_NoLoss_S = 10; //Shows how many points after the first Sell order, the NoLoss function will start operating
FixLotBuy = 0.1; //if=0, the lot will be calculated as a percentage of free funds at risk %
FixLotSell = 0.1; //if=0, the lot will be calculated as a percentage of free funds at risk %
DigitsLot = 2; //number of decimal places in the lot size (2 – 0,01) (1 – 0,1)
risk = 1;
K_LotBuy = 1.0; //lot multiplication
Plus_LotBuy = 0.1; //lot increase
K_LotSell = 1.0; //lot multiplication
Plus_LotSell = 0.1; //lot increase
ProfitClose = 0; //close all orders when profit is received, if 0, then automatic profit calculation
Koeff_Profit = 1.0; //ProfitClose coefficient = ProfitClose * Koeff_Profit
DeltaToClose = 100; //the distance between the uppermost and the lowest order at which closing by ProfitClose is allowed
TrailingPercent = 0; //if 0, then orders are closed by ProfitClose, otherwise they are trailed,
//starting from ProfitClose with a rollback in TrailingPercent as a percentage of the current profit
slippage = 10; //Maximum allowable price deviation for market orders
TimeStart = 0 , //time limit of the Expert Advisor
timeEnd = 24; //do not open orders and close deposits if the time is not between TimeStart and timeEnd
UpBuy = 0; //the upper level of placing Buy orders (it is impossible to set Buy higher) If 0, then there is no restriction
DnBuy = 0; //the lower level of placing Buy orders (it is impossible to set Buy below) If 0, then there is no restriction
UpSell = 0; //the upper level of placing Sell orders (it is impossible to set Sell higher) If 0, then there is no restriction
DnSell = 0; //the lower level of placing Sell orders (it is impossible to set Sell below) If 0, then there is no restriction
AlertOn = true; //on/off Alert window
DrawInfo = true; //displaying information on the screen
MaxOrders = 10; //limit on the number of orders in each direction
Key = 6304338;
By setting level.of.zero = true; TrailingStop and NoLoss breakeven will be calculated from the total breakeven level of each direction.
if level.of.zero = false, then the trailing and breakeven will be counted for each individual order.
The lot can be fixed, for this the FixLot value must be greater than 0, otherwise the lot will be calculated as a percentage of available funds.
Each subsequent lot of a separate direction can be increased by the coefficient K_Lot
Orders are opened only in the time interval from TimeStart to timeEnd, but if the series is not closed, then orders can be opened before the series closes.
The UpBuy, DnBuy, UpSell, DnSell parameters limit the range of Buy and Sell orders.
For the profitable operation of the Expert Advisor, it is necessary to optimize it on your trading account, only then you will be able to trade it successfully. How to optimize read here:
Opimization of the adviser
On the telegram channel, I will periodically post sets for optimization
The adviser is conditionally free. You can use it in the tester and on demo accounts without any restrictions. To work on a real account, you need a key, its price is 50 USD (3500 rubles)
If you have any questions about getting the key, write to me;