problem to select order

 

hi every body

If in a EA for example we have two open order that the currency is the same and both of them are buy mode and we want to modify them . how ca we select both of them to modify? we do not know the ticket no. and oreder no.

Tnx

 
for(int i = OrdersTotal()-1; i >= 0; i--)
   {
   OrderSelect(i, SELECT_BY_POS, MODE_TRADES);
   if(OrderSymbol() == Symbol() && OrderType() == OP_BUY) 
      { 
      OrderModify(...);
      }
   } 
 
qjol:


with thanks for your prompt reply

for(int i = OrdersTotal()-1; i >= 0; i--)
{
OrderSelect(i, SELECT_BY_POS, MODE_TRADES);
if(OrderSymbol() == Symbol() && OrderType() == OP_BUY)
{
OrderModify(????..);
}
}

how can I determine ticket no. because the buy position is in cycle and for each cycle two buy will be opened and modifyed

 

why do you need determine the ticket no.?

 
qjol:

why do you need determine the ticket no.?


OrderModify(????..);

I mean what is first parameter of OrderModify

for example

OrderModify(i,OrderOpenPrice(),0,y1,0,Blue)

or

OrderModify(OrderTicket(),OrderOpenPrice(),0,y1,0,Blue)

 
 


my friend

please note I have two open order and want to modify both of them only in Take Profit

please wrote the complete program (OrderModify)

 

u want the all code :(

extern int SellStoploss = 200;
extern int SellTakeprofit = 1000;

double SL = Bid + SellStoploss*Point;
if (SellStoploss == 0) SL = 0;
double TP = Bid - SellTakeprofit*Point;
if (SellTakeprofit == 0) TP = 0;

for(int i = OrdersTotal()-1; i >= 0; i--)
   {
   OrderSelect(i, SELECT_BY_POS, MODE_TRADES);
   if(OrderSymbol() == Symbol() && OrderType() == OP_BUY) 
      { 
      OrderModify(OrderTicket(), OrderOpenPrice(), SL, TP, 0, Red);
      }
   } 
 
qjol:

u want the all code :(


Thank you very much

another question (sorry)

What does it mean if (OrderSymbol() == Symbol()

I can not understand it

 
Reason: