Multiple pending orders

 
I WANT TO WRITE AN EA that will place 5 buy pending orders above the present price at 5 pips interval and 5 sell orders at same interval below the present price. Anyone can help with the code please.
 
double price, sl, tp;
 
price = Ask + 5*Point;
sl = ...
tp = ...
 
OrderSend(Symbol(), OP_BUYSTOP, ...
 
price = Ask + 10*Point;
sl = ...
tp = ...
 
OrderSend(Symbol(), OP_BUYSTOP, ...
 
...
 
I guess, the regular EA template should do this...when you say 5 orders, would they have different S/L and profit targets? 'Cause if not, then you can just change the number of lots instead..

But, if you want to have multiple orders...then in the EA, change the line that checks for openorders...

total=OrdersTotal();
   if(total<1)
Change 1 to 10 or whatever number of orders you wish to open...
 
RICKD and MarathaThanks you very much for your answers, i have implemented this and it is working. Now, if one of the orders is opened it has to cancel others in the opposite directions. For example if the first buy order is open , then all sell orders must be cancelled. Please tell me how to do that please.
Reason: