Download MetaTrader 5

OrderSelect() always returns true

To add comments, please log in or register
Mark Reno
148
Mark Reno  
bool mh = OrderSelect(tck, SELECT_BY_TICKET, MODE_HISTORY );
bool mt = OrderSelect(tck, SELECT_BY_TICKET, MODE_TRADES );
Print("mh: ", mh, "  mt: ", mt, "  OrderClosePrice(): ", OrderClosePrice());


That is my code.  I am running MT4 build 840. Using the history tester
What is the problem?  BOTH the 'mh', and 'mt', variables return 'true' at all times.  It does not matter whether the trade is open or closed.

Keith Watford
Moderator
9641
Keith Watford  

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. 

whroeder1
14779
whroeder1  
What is the problem?  BOTH the 'mh', and 'mt', variables return 'true' at all times.  It does not matter whether the trade is open or closed. There is no problem! BOTH the 'mh', and 'mt', variables will return 'true' at all times if you have a valid ticket number.  It does not matter whether the trade is open or closed, or pending or deleted.
Mark Reno
148
Mark Reno  
MehZhure:


That is my code.  I am running MT4 build 840. Using the history tester
What is the problem?  BOTH the 'mh', and 'mt', variables return 'true' at all times.  It does not matter whether the trade is open or closed.

WHRoeder:
What is the problem?  BOTH the 'mh', and 'mt', variables return 'true' at all times.  It does not matter whether the trade is open or closed. There is no problem! BOTH the 'mh', and 'mt', variables will return 'true' at all times if you have a valid ticket number.  It does not matter whether the trade is open or closed, or pending or deleted.

Ah yes!  I did not catch that until I read further down in the "Note" section.  Thank you for pointing that out.
To add comments, please log in or register