Question about pending orders access

 
   for(int x=PositionsTotal();x>=0;x--){
      ulong ticket = PositionGetTicket(x);
      
      if(PositionSelectByTicket(ticket)){
         string positionGetInteger_Type ;
        // switch syntax
         switch((int)PositionGetInteger(POSITION_TYPE)) {
         case 0:positionGetInteger_Type = "Buy Order";break;
         case 1:positionGetInteger_Type = "Sell Order";break;
         }
         Print(x," ", positionGetInteger_Type," ",
         PositionGetDouble(POSITION_PRICE_OPEN)," ",
         PositionGetString(POSITION_SYMBOL)," ",
         PositionGetSymbol(x)," ",
         PositionGetDouble(POSITION_PROFIT));
      }

I would like to ask , how can I get into all pending orders

Thanks . 

 
   for(int x=0;x<PositionsTotal();x++){
      ulong ticket = PositionGetTicket(x);
      
      if(PositionSelectByTicket(ticket)){
         string positionGetInteger_Type ;
        // switch syntax
         switch((int)PositionGetInteger(POSITION_TYPE)) {
         case 0:positionGetInteger_Type = "Buy Order";break;
         case 1:positionGetInteger_Type = "Sell Order";break;
         }
        /*
        // if else syntax
        if(PositionGetInteger(POSITION_TYPE)== 0){ positionGetInteger_Type = "Buy Order";}
        else {positionGetInteger_Type = "Sell Order";}
        */
         Print(x," ", positionGetInteger_Type," ",
         PositionGetDouble(POSITION_PRICE_OPEN)," ",
         PositionGetString(POSITION_SYMBOL)," ",
         PositionGetSymbol(x)," ",
         PositionGetDouble(POSITION_PROFIT)," ",
         PositionGetTicket(x));
         // OrdersTotal == Pending Orders , PositionGetxxx == Order exist
      }
     }   
   for(int y=0;y<OrdersTotal();y++){
   ulong tickets=OrderGetTicket(y);
   
      if(OrderSelect(tickets))
         // OrdersTotal == Pending Orders , PositionGetxxx == Order exist
         Print(y,"<< arr  ",
         (int)OrdersTotal(),"<< Total  ",
         OrderGetTicket(y),"<< Ticket  ",
         OrderGetString(ORDER_SYMBOL),"<< Symbol  ",
         OrderGetDouble(ORDER_PRICE_OPEN),"<< PriceOpen ",
         "End"
         );
         
   }

I think I have found the answer :) Thanks everyone 

 
Yip Sin Hang:

I would like to ask , how can I get into all pending orders

#include <MT4Orders.mqh> // https://www.mql5.com/en/code/16006

void OnStart()
{
  for (int i = OrdersTotal() - 1; i >= 0; i--)
    if (OrderSelect(i, SELECT_BY_POS))
      OrderPrint();
}
Reason: