Variable Loop Syntax

Hi I wonder if somebody could help as I am looking for ways to reduce the length of my code.

I have got 3 variables tick1,tick2 & tick3

if (OrderComment() == "Euro_Level_3" ) 
{   OrderModify (tick1,0,0,OrderOpenPrice()+(PipsToProtect*Point),0,Blue);
    OrderModify (tick2,0,0,OrderOpenPrice()+(PipsToProtect*Point),0,Blue);
    OrderModify (tick3,0,0,OrderOpenPrice()+(PipsToProtect*Point),0,Blue);
}



Instead of having the 3 OrderModify lines is it possible to put the 3 lines into a for loop, changing tick1,2&3 with a loop. If this is possible can somebody please show me the syntax.
Many Thanks
Madmarkym

Put the tickets in an array and step through the array in the loop
Hi Phy

Could you possible show me a little example please?

Many Thanks for your time

Madmarkym
Here is what I would do, not really what is described above


string comment = "Euro_Level_3";

for(i = OrdersTotal()-1; i>=0; i--){
   OrderSelect(i, SELECT_BY_POS, MODE_TRADES);
   if(OrderComment() == comment ){
      if(OrderType() == OP_BUY ){
          OrderModify (OrderTicket(), ...........);
      }
      if(OrderType() == OP_SELL ){
          OrderModify (OrderTicket(), ...........);
      }
   }
}



Hi Phy

Thanks for your continued help, it is most appreciated.
I understand how your example works, but is it possible to put the variables tick1, tick2 & tick3 into an array, to allow me to put the tick variable into a loop to increment it.

Many Thanks again
Madmarkym
double myArray[3];
myArray[0] = tick1;
myArray[1] = tick2;
myArray[2] = tick3;
double myArray[3];
myArray[0] = tick1;
myArray[1] = tick2;
myArray[2] = tick3;


Hi,

Would it not be:

int myArray[3];

as the first parameter in OrderModify(...) requires an integer representing the order ticket number?

Regards,
lucidlamp
Many Thanks for all the help, it has been most appreciated.

scouseman