OpenOrders shows 0 despite I have 13 open positions??

To add comments, please log in or register
Carl Schreiber
Moderator
7282
Carl Schreiber  

I have on a demo account 13 open positions:

13 positions

but OrdersTotal() shows zero(?):

    uint o = OrdersTotal();
    Comment("OrdTotal ",o);

How do you get the open positions in MQL5?

Marco vd Heijden
Moderator
8429
Marco vd Heijden  
Documentation on MQL5: Trade Functions / PositionsTotal
Documentation on MQL5: Trade Functions / PositionsTotal
  • www.mql5.com
Trade Functions / PositionsTotal - Reference on algorithmic/automated trading language for MetaTrader 5
Carl Schreiber
Moderator
7282
Carl Schreiber  

Ah - I understand.

Coming from MQL4 I was baffled by the example in the reference:

uint     total=OrdersTotal(); 
//--- gehen wir im Zyklus durch alle Ordern  
   for(uint i=0;i<total;i++) 
     { 
      //--- erhalten wir Orderticket in Bezug auf seine Position in der Liste  
      if((ticket=OrderGetTicket(i))>0) 
        { 
....
Enrique Dangeroux
435
Enrique Dangeroux  
Carl Schreiber:

Ah - I understand.

Coming from MQL4 I was baffled by the example in the reference:

In MQL5 OrdersTotal() returns count of pending orders.

To add comments, please log in or register