Debug - OrderGetTicket always returning zero

hi guys,

here is classical code, but OrderGetTicket() always return 0 even if i have a lot of orders

OrdersTotal()is ok

why ?

 uint     total=OrdersTotal(); 

  //--- go through orders in a loop 

   for(uint i=0;i<total;i++) 


      //--- return order ticket by its position in the list 



         //--- return order properties 

         open_price    =OrderGetDouble(ORDER_PRICE_OPEN); 

         time_setup    =(datetime)OrderGetInteger(ORDER_TIME_SETUP); 

         symbol        =OrderGetString(ORDER_SYMBOL); 

         order_magic   =OrderGetInteger(ORDER_MAGIC); 

         positionID    =OrderGetInteger(ORDER_POSITION_ID); 


         type          =EnumToString(ENUM_ORDER_TYPE(OrderGetInteger(ORDER_TYPE))); 

         //--- prepare and show information about the order 

         printf("#ticket %d %s %G %s at %G was set up at %s", 

                ticket,                 // order ticket 

                type,                   // type 

                initial_volume,         // placed volume 

                symbol,                 // symbol 

                open_price,             // specified open price 

                TimeToString(time_setup)// time of order placing 





Please EDIT your post and use the SRC button when you post code.

Thank you.


This works on me, even though there are many positions.

     //| Get data from pending orders  |
     ulong ticket;
     ulong total=OrdersTotal();
     for (ulong i=0; i<total; i++) 
           //--do something
           Print("* Ticket: ",ticket);

       }//--end if
     }//--end for

OrdersTotal() is related to pending orders, not to positions.

ohh… yes, you’re right .

I mean “positions” of pending orders

not code syntax for position PositionsTotal() … 。◕‿◕。


You should update your trading vocabulary

Yes, I do (^̮^) …

thanks htwyford1p & vpeabody1

everything is ok, i’m working with Positions, it’s better