OrderType returns wrong parameters and not working

 

hi,


this is my code:

 for(int counter = 0; counter <= OrdersTotal() - 1; counter++)
      {
         if(OrderSelect(OrdersTotal()-1, SELECT_BY_POS))
        // { 
            if(OrderSymbol() == Symbol() && OrderMagicNumber()==10)
            {                    
                 // if(OrderType()==OP_SELL) //|| OrderType()==OP_BUY)
                  { 
                  

                  
                  //Print("Symbol: " + _Symbol + ";Type: " + OrderType()+";Magic Number: " +OrderMagicNumber()+ "Count: "+(OpenTradesForMNandPairType(MagicNumber,_Symbol))); //+ Count(OpenTradesForMNandPairType(MagicNumber,_Symbol));
                  
                     //Print(OrderTicket());
                  
                  
                  }
                  
                  }
                  
                  
                 // }
                  }



OrderType with OP_BUY or OP_SELL always working, now not working. For OP_SELL  I got 4 number with ordertype Print(OrderType())  and I want only to use order type if is not pending order. Thanks.


Regards

 
  1. You are selecting the same order repeatedly.
  2. Filter by OrderType.
 
Dejan Krapez:

hi,


this is my code:



OrderType with OP_BUY or OP_SELL always working, now not working. For OP_SELL  I got 4 number with ordertype Print(OrderType())  and I want only to use order type if is not pending order. Thanks.


Regards

 for(int counter = 0; counter <= OrdersTotal() - 1; counter++)
      {
         if(OrderSelect(counter, SELECT_BY_POS))
          { 
            if(OrderSymbol() == Symbol() && OrderMagicNumber()==10 )
     
           {  
               // 
               //
               //

            }