OrderSelect(97936536, SELECT_BY_TICKET, MODE_TRADES) ----> return TRUE (right);
OrderSelect(97936536, SELECT_BY_TICKET, MODE_HISTORY) ----> return TRUE (what ???);
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."
if SELECT_BY_TICKET is used, MODE_TRADES and MODE_HISTORY are ignored.
eehhhmm just...
i hoped i read wrong....
In this way i can read from MODE_HISTORY, only with SELECT_BY_POS (then in a loop)....
i hoped that i can do it...
luckily in my EA i can can use another logic.
Well, okey, very thanks.
Have a nice day!
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."
if SELECT_BY_TICKET is used, MODE_TRADES and MODE_HISTORY are ignored.
okey, BUT see this:
(order ticket 97944740 is open)
OrderSelect(97944740, SELECT_BY_TICKET, MODE_TRADES) = TRUE
OrderSelect(97944740, SELECT_BY_TICKET, MODE_HISTORY) = TRUE
(and this is okey, because in OrderSelect with SELECT_BY_TICKET, it find ONLY in the pool MODE_TRADES)
(order ticket 97936536 is close)
OrderSelect(97936536, SELECT_BY_TICKET, MODE_TRADES) = TRUE (false positive ???)
OrderSelect(97936536, SELECT_BY_TICKET, MODE_HISTORY) = TRUE (but then can i use mode SELECT_BY_TICKET, for find in the pool MODE_HISTORY ???)
Only the discriminating is OrderCloseTime():
if order is open OrderCloseTime()=D'1970.01.01 00:00:00' (minimal value for variable datetime type)
if order is close OrderCloseTime()=[datatime of close order]
In my EA i find if order is open with OrderSelect([int Ticket], SELECT_BY_TICKET, MODE_TRADES),
else if order is close with OrderSelect([int Ticket], SELECT_BY_TICKET, MODE_HISTORY) and i check value of OrderCloseTime()
enum ORDER_STATUS {STATUS_OPEN, STATUS_CLOSED, STATUS_ERROR}; ORDER_STATUS orderStatus(int ticket) { if (!OrderSelect(ticket, SELECT_BY_TICKET)) return STATUS_ERROR; return OrderCloseTime() > 0 ? STATUS_CLOSED : STATUS_OPEN; } void OnStart() { int ticket = 9802232; printf("Ticket #%d - status=%s", ticket, EnumToString(orderStatus(ticket)) ); }

- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
Hi at all,
can i use this ---> OrderSelect([int ticket], SELECT_BY_TICKET, MODE_HISTORY) ?
In the execution this method run, but the return is unexpected for me.
USE CASE:
i have open a buy order, ticket of this order = 97936536
run my EA, and test it (order ticket 97936536. it still open):
OrderSelect(97936536, SELECT_BY_TICKET, MODE_TRADES) ----> return TRUE (right);
OrderSelect(97936536, SELECT_BY_TICKET, MODE_HISTORY) ----> return TRUE (what ???);
thanks at all