Array loop problems!! Why array elements are zero? OrdersTotal is grather than 2 in my case.

 
double mypool[][2]; 
int secondticket, lastTicket, count;
double secondPrice, lastPrice, dif;
   
   for(int i=0; i<OrdersTotal(); i++)
     {
      if(OrderSelect(i,SELECT_BY_POS,MODE_TRADES)==false)
         break;
      if(
         (OrderMagicNumber()==MAGICMA_n) && 
         (OrderSymbol()==Symbol()) && 
         (OrderType()==tipo)
         )
        { 
          ArrayResize(mypool,count);
          mypool[i][0]=OrderTicket();
          mypool[i][1]=OrderOpenPrice();
            count++; 

         }        
     }

     if( count>1)
       {
          ArraySort(mypool,count,0,MODE_DESCEND);
          lastTicket=mypool[0,0];
          secondticket=mypool[1,0];
          lastPrice=mypool[0,1];
          secondPrice=mypool[1,1];
       }
    double volume = (MathAbs(secondPrice-lastPrice);
 
          ArrayResize(mypool,count);
          mypool[i][0]=OrderTicket();
          mypool[i][1]=OrderOpenPrice();
            count++; 
  1. Are you using strict? Always use strict. Fixing the warnings will save you hours of debugging, but you must understand the differences.

    If so, what is the initial value of count?

  2. If count is initially zero, what does your resize do?
  3. After you enlarge mypool to count, why do you try to store in i?
 
William Roeder:
  1. Are you using strict? Always use strict. Fixing the warnings will save you hours of debugging, but you must understand the differences.

    If so, what is the initial value of count?

  2. If count is initially zero, what does your resize do?
  3. After you enlarge mypool to count, why do you try to store in i?
I am not using strict. ANd the initial value of count is zero.
 
Roberto Mesquita:
I am not using strict. ANd the initial value of count is zero.
I want to store the OrderOpenPrice and the OrderTicket in this array
 
  1. Roberto Mesquita: I am not using strict. ANd the initial value of count is zero.

    Not "ANd" but because you are not using strict the initial value of count is zero. There are no mind readers here and our crystal balls are cracked.

  2. Roberto Mesquita: I want …
    That was obvious from your posted code.
 
Roberto Mesquita:
I am not using strict. ANd the initial value of count is zero.

Thanks for your help

I change to strict and corrected the errors.

The array size was the problem.