I want check to a symbol ()

 

 I want check to a symbol ()

 Thank you

 

if(OrdersTotal() > 0){ // verifica se existe ordens abertas
     
      for(int i=OrdersTotal();i>=0;i--){ // cria um loop decrescente com valor inicial igual ao total de ordens abertas
        
         if(OrderSelect(i,SELECT_BY_POS,MODE_TRADES)){ // seleciona a ordem dentro do loop
             
             switch(OrderType()){ // verifica o tipo da ordem 
                  case 0:
                      // 0 - buy
                        
                  case 1:                     
                        // 1 - sell
                        
                  case 2: 
                        // 2 - buy limit 
                        
                  case 3:
                        // 3 - sell limit
                        
                  case 4:
                        // 4 - buy stop
                        
                        
                  case 5:          
                        // 5 - sell stop     
                        
                                            
            } 
       }   
  }
}
 
Tiago Cetto Pietralonga:

 I want check to a symbol ()

 Thank you

Hi Tiago Cetto Pietralonga,

Please try to use the SRC button when pasting parts of code there in the Forum.

This time I'll do that for you. 

Regards,
Malacarne 

 
Tiago Cetto Pietralonga:

 I want check to a symbol ()

 Thank you

 

//+------------------------------------------------------------------+
if(OrdersTotal()>0)
  { // verifica se existe ordens abertas

   for(int i=OrdersTotal();i>=0;i--)
     { // cria um loop decrescente com valor inicial igual ao total de ordens abertas

      if(OrderSelect(i,SELECT_BY_POS,MODE_TRADES))
        { // seleciona a ordem dentro do loop

         switch(OrderType())
           { // verifica o tipo da ordem 
            case OP_BUY:
               // 0 - buy

               break;
            case OP_SELL:
               // 1 - sell

               break;
            case OP_BUYLIMIT:
               // 2 - buy limit 

               break;
            case OP_SELLLIMIT:
               // 3 - sell limit

               break;
            case OP_BUYSTOP:
               // 4 - buy stop

               break;
            case OP_SELLSTOP:
               // 5 - sell stop     

               break;
           }
        }
     }
  }
//+------------------------------------------------------------------+
 

This will check out for Symbol()

//+------------------------------------------------------------------+
   int ordersTotal = OrdersTotal();

   //--- search in all open positions
   for (int i = ordersTotal - 1; i >= 0; i--)
   {
      //--- if an error occurs at selecting of this position then go to the next one...
      if (!OrderSelect(i, SELECT_BY_POS,MODE_TRADES)) continue;

      //--- if the position was opened not for the current symbol, skip it...
      if (OrderSymbol() != Symbol()) continue;

      switch(OrderType())
      { 
         case OP_BUY:
            // 0 - buy
            break;

         case OP_SELL:
            // 1 - sell
            break;

         case OP_BUYLIMIT:
            // 2 - buy limit 
            break;

         case OP_SELLLIMIT:
            // 3 - sell limit
            break;

         case OP_BUYSTOP:
            // 4 - buy stop
            break;

         case OP_SELLSTOP:
            // 5 - sell stop     
            break;
        }
     }
  }
//+------------------------------------------------------------------+
 
Anton Nel:

This will check out for Symbol()

Thank you, it's working