I need of a ticket[n] funcion

Hi!

I need help again…

Detail: When I did simple questions in beginner area, none wanted answer me, because my doubts was too much easy. Let’s see now if the users are good with complicated questions…

What I want to create are these 6 functions:

TicketNumber = N[n]
TicketNumber = M[m]

TicketNumber = X[x]
TicketNumber = Y[y]

TicketNumber = V[v]
TicketNumber = W[w]

Look here: http://www.myfxbook.com/files/JHenrique/Doubt.png

Such that:

ALL Positions:

Order = N[n] = M[m]
142370816 = N[0] = M[13]
142370788 = N[1] = M[12]
142370758 = N[2] = M[11]
:
:
:
142370606 = N[11] = M[2]
142370565 = N[12] = M[1]
142370543 = N[13] = M[0]

BUY Positions:

Order = X[x] = Y[y]
142370816 = X[0] = Y[7]
142370788 = X[1] = Y[6]
142370701 = X[2] = Y[5]
:
:
:
142370606 = X[5] = Y[2]
142370565 = X[6] = Y[1]
142370543 = X[7] = Y[0]

SELL Positions:

Order = V[v] = W[w]
142370758 = X[0] = Y[5]
142370743 = X[1] = Y[4]
142370711 = X[2] = Y[3]
:
:
:
142370606 = X[3] = Y[2]
142370645 = X[4] = Y[1]
142370631 = X[5] = Y[0]

Do you understand?? I don’t know how to create this… :S

I hope this is what oyu had in mind:

int COa, COb, COc, N[], M[], X[], Y[], V[], W[], s=0,b=0;

int start()
  {   

if (OrdersTotal()>0 && (OrdersTotal()!=COc || COc==NULL))
   {COa=OrdersTotal()-1;
    while (COa>=0)
          {COb=0;
           ArrayResize(N,COa+1);
           ArrayResize(M,COa+1);
           OrderSelect(COa,SELECT_BY_POS,MODE_TRADES);
           N[COb]=OrderTicket(); M[COa]=OrderTicket();
           if (OrderType()==0) {b=b+1; ArrayResize(X,b); ArrayResize(Y,b); X[b-1]=OrderTicket();};
           if (OrderType()==1) {s=s+1; ArrayResize(V,s); ArrayResize(W,s); V[s-1]=OrderTicket();};
           COb++; COa--;};
    COa=0; COb=0;    
    while (b>0)
          {W[b-1]=V[0+COa];
           b--;COa++;};   
    while (s>0)
          {W[s-1]=V[0+COb];
           s--;COb++;};
    COc=OrdersTotal();
    Alert("Nuber of Orders: ",COc);
    Alert("Nuber of Buy Orders: ",COa);
    Alert("Nuber of Sell Orders: ",COb);
    };

return(0);                              
}