Download MetaTrader 5

Need help on OrderSelect()

To add comments, please log in or register
Do you know that MQL5 has event handling?
web11
268
web11 2015.12.23 15:01 

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
3737
Xiangdong Guo 2015.12.23 15:31  

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
9243
Lorentzos Roussos 2015.12.23 16:17  
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