Download MetaTrader 5

Need help on OrderSelect()

To add comments, please log in or register
web11
293
web11  

Dear,

I am little bit confuse with OrderSelect(). I wrote below functions

Alert(OrderSelect(15958423, SELECT_BY_TICKET, MODE_HISTORY) +"   "+OrderSelect(15958612, SELECT_BY_TICKET, MODE_TRADES));

open trade open then MODE_HISTORY show true and MODE_TRADES also show true.

as i know history only show order cancel or close. then why "OrderSelect(15958423, SELECT_BY_TICKET, MODE_HISTORY)" return true.

but when i close the trade then also both function return true. why?


no trade but also show 'OrderSelect(15958612, SELECT_BY_TICKET, MODE_TRADES)' return true

please help me

Xiangdong Guo
4367
Xiangdong Guo  

Please read MQL4 Reference carefully.

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

Lorentzos Roussos
15655
Lorentzos Roussos  
bool select;
select=OrderSelect(your_ticket,SELECT_BY_TICKET);
if(select)
  {
  if(OrderCloseTime()==0)
     {
     //order is open
     } 
  if(OrderCloseTime()!=0)
     {
     //order is closed
     }
  }
To add comments, please log in or register