Major OrderSelect() bug! Seen on backtester and demo - might be on live too

 

This has surfaced while working these days. It seems that, regardless that an order is active or closed (we tried only with market orders), both modes OrderSelect(), MODE_TRADES and MODE_HISTORY, will return true. If an order never existed, both will return correctly, false. Test it yourself: launch a market order and try the following script:

 

void OnStart()
  {
   int ticket=41341306;// Your test Ticket!!!!!
   if (OrderSelect(ticket,SELECT_BY_TICKET,MODE_TRADES)==true)
     Print("MODE_TRADES: ticket ",ticket," is SELECTED");
   else
     Print("MODE_TRADES: ticket ",ticket," is NOT SELECTED");
     
   if (OrderSelect(ticket,SELECT_BY_TICKET,MODE_HISTORY)==true)
     Print("MODE_HISTORY: ticket ",ticket," is SELECTED");
   else
     Print("MODE_HISTORY: ticket ",ticket," is NOT SELECTED") ;
  }
 
Read the documentation OrderSelect - MQL4 Documentation

Note

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

 

Thanks 

Reason: