English

## assign 5 differents order open price to 5 local variables

 41 itriad 2016.04.27 02:41   Hello, I have a problem to assign values to different local variable, I have 5 position open at different prices butmy script gives the same value to 5 different variablesWhere is the problem??? thank you for any help
 Moderator3416 GumRai 2016.04.27 02:47 #   As you don't show any code, how can we know?
 41 itriad 2016.04.27 02:48 #   ```//---    double    orders1=0;//first order open price    double    orders2=0;//second order open price    double    orders3=0;//third order open price    double    orders4=0;//fourth order open price    double    orders5=0;// etc etc etc etc      {       for(int i=0; i ",orders1);// here is my problem all the variable have the same value??    Print("orders2 --> ",orders2);    Print("orders3 --> ",orders3);    Print("orders4 --> ",orders4);    Print("orders5 --> ",orders5);```
 41 itriad 2016.04.27 02:52 #   2016.04.27 02:30:56.399 Script loop #ENM6,M5: removed2016.04.27 02:30:56.399 loop #ENM6,M5: uninit reason 02016.04.27 02:30:56.399 loop #ENM6,M5: orders5 --> 1.129812016.04.27 02:30:56.399 loop #ENM6,M5: orders4 --> 1.129812016.04.27 02:30:56.399 loop #ENM6,M5: orders3 --> 1.129812016.04.27 02:30:56.399 loop #ENM6,M5: orders2 --> 1.129812016.04.27 02:30:56.399 loop #ENM6,M5: orders1 --> 1.12981
 41 itriad 2016.04.27 02:55 #   thank you for any help
 Moderator3416 GumRai 2016.04.27 03:31 #   ```   if(orders1==0)      {      orders1=OrderOpenPrice();      continue;      }```and do the same for every if in the loop
 41 itriad 2016.04.27 03:44 #   thank you very much it works
 41 itriad 2016.04.27 12:44 #   I'm a little confused with the "continue" method,how to do without the "continue" if possible?thank you all
 12995 WHRoeder 2016.04.27 14:57 #   itriad: how to do without the "continue" if possible?```      if( orders1==0){orders1=OrderOpenPrice();}// my open price is 1.13104       else  if(orders2==0){orders2=OrderOpenPrice();}// my open price is 1.13053       else  if(orders3==0){orders3=OrderOpenPrice();}// my open price is 1.13105       else  if(orders4==0){orders4=OrderOpenPrice();}// my open price is 1.13032       else  if(orders5==0){orders5=OrderOpenPrice();}// my open price is 1.13075```Or handle the general case```   double    orders{];  int nOrders=0       for(int i=0; i ",orders[1);    Print("orders2 --> ",orders[2];    Print("orders3 --> ",orders[3];    Print("orders4 --> ",orders[4];    Print("orders5 --> ",orders[5];```Note: No filtering on your OrderSelect loop means your code is incompatible with every EA (including itself on other charts and manual trading.) Symbol Doesn't equal Ordersymbol when another currency is added to another seperate chart . - MQL4 forum
 41 itriad 2016.04.27 15:26 #   it works, a big thank you especially to WHroeder and Gumrai
 41 itriad 2016.04.27 15:53 #   ```   double    orders[];  int nOrders=0;    for(int i=0; i ",orders[0]);// <--- 1  if i start to 1, i have array out of range in 'loop.mq4' (26,31)    Print("orders2 --> ",orders[1]);// <--- 2    Print("orders3 --> ",orders[2]);// <--- 3    Print("orders4 --> ",orders[3]);// <--- 4    Print("orders5 --> ",orders[4]);// <--- 5   }```it works perfectly thanks again