Download MetaTrader 5

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

To add comments, please log in or register
Develop applications to order. Make profit using Freelance service!
Bogdan Alin Baltatu
2924
Bogdan Alin Baltatu 2015.02.20 17:05 

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") ;
  }
whroeder1
14470
whroeder1 2015.02.20 18:14  
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.

Bogdan Alin Baltatu
2924
Bogdan Alin Baltatu 2015.02.23 10:35  

Thanks 

To add comments, please log in or register