Download MetaTrader 5

CLOSED OR OPENED TRADE

To add comments, please log in or register
Do you want to deposit to your account? Do this in any convenient way!
paulselvan
304
paulselvan 2015.09.21 08:19 

Hi, 

I closed a trade.

So  the function OrderSelect( Ticket , SELECT_BY_TICKET,  MODE_HISTORY ) returns TRUE as expected.

 I suppose closed trade can only be found   on   MODE_HISTORY    not   on    MODE_TRADES. 

But why  OrderSelect(Ticket , SELECT_BY_TICKET,  MODE_TRADES) returns also TRUE ....?

My problem is : i want to check if a trade with given TICKET is only on open  trades not in pending orders or closed ones.  

Tnx 

Keith Watford
Moderator
9596
Keith Watford 2015.09.21 10:06  

Read the documentation

Note

The pool parameter is ignored if the order is selected by the ticket number. The ticket number is a unique order identifier. 

whroeder1
14455
whroeder1 2015.09.21 12:32  
and if it is closed, OrderCloseTime will not be zero.
paulselvan
304
paulselvan 2015.09.21 15:47  

@WHRoeder

That's right : the function  OrderCloseTime() is good for selecting opened trades because their time is setted at 1 970.01.01 00.00.00


OrderHistoryTotal() or OrdersTotal() dont give pending orders TICKET

How to see only all pending orders TICKETs  ?

Tnx 

whroeder1
14455
whroeder1 2015.09.22 13:20  
paulselvan: OrderHistoryTotal() or OrdersTotal() dont give pending orders TICKET
False. Pending orders (in the order pool) or deleted/expired pending (in the history pool) are part of the count. Select by position, not by ticket.
To add comments, please log in or register