Hi, I'm trying to read values with OrderSelect active orders only

 
Hi, I'm trying to read values with OrderSelect active orders only, but when I have pending orders, the code read thei values also. Can somebody help with OrderSelect function to ignore pending order values when I have some, but I don't need their values?
 
MT4: skip when OrderType()>1

MT5: cycle PositionsTotal() only and not OrdersTotal()
 
Fabio Cavalloni #:
MT4: skip when OrderType()>1

MT5: cycle PositionsTotal() only and not OrdersTotal()
I'm trying with.... if( OrderType() < 2.....) but it still reads them
 
Cvetan Michev :
Hi, I'm trying to read values with OrderSelect active orders only, but when I have pending orders, the code read thei values also. Can somebody help with OrderSelect function to ignore pending order values when I have some, but I don't need their values?

Are you coding on MT4 or MT5?

 
Dao Thi Thanh Nguyet #:

Are you coding on MT4 or MT5?

MT4
 
you don't need 3 accounts tho 
 
Lorentzos Roussos #:
you don't need 3 accounts tho 

Is there a problem how many accounts do I have? Different PC, different Account is loged in

 
Cvetan Michev #:

Is there a problem how many accounts do I have? Different PC, different Account is loged in

for(int i=(OrdersTotal()-1);i>=0;i--){
if(OrderSelect(i,SELECT_BY_POS,MODE_TRADES)){
if(OrderType()==OP_BUY||OrderType()==OP_SELL){

}
}
}

this is how you loop avoiding pendings in mt4

 
Cvetan Michev #:

Is there a problem how many accounts do I have? Different PC, different Account is loged in

Yes it is. It's not allowed by the site rules to use several accounts by 1 user.
 
Alain Verleyen #:
Yes it is. It's not allowed by the site rules to use several accounts by 1 user.
it was a colleague's account from another computer that was available when I replied on the forum. I will now only use the personal one for correspondence on various topics. thank you