how to check same ticket ?

 

how to check same ticket ?

I use follow code,but can't check same ticket...

void OpenPosition() {
            int b=0;
            int s=0;
            int bb=0;
            int ss=0;
            int li_4 = OrdersTotal() - 1;
           for (int l_pos_8 = li_4; l_pos_8 >= 0; l_pos_8--) {
      if (OrderSelect(l_pos_8, SELECT_BY_POS, MODE_TRADES)) {
         if (OrderType() == OP_SELL && OrderLots()==0.1) {
            if (MathAbs((OrderOpenPrice() - Bid)) >= 930*Point) {
              s=1;    
              ss=ss+1; 
            }
         }
         if (OrderType() == OP_BUY && OrderLots()==0.1) {
            if (MathAbs((OrderOpenPrice()-Ask)) >=930*Point) {
               b=1;
               bb=bb+1;
            }
         }
      }
   }
 

Do you have the Ticket#? What are you checking the Ticket for? Why didn't you select by Ticket?

OrderSelect(TICKET, SELECT_BY_TICKET, MODE_TRADES).

 
for (int l_pos_8 = li_4; l_pos_8 >= 0; l_pos_8--) {
Decompiled code
Reason: