Download MetaTrader 5
To add comments, please log in or register
How to earn at MQL5.community? Come and find out!
Baruch Fishman
705
Baruch Fishman 2014.05.26 16:15 
I would just like to report that sometimes the OrderCloseTime() is returning 0 even thought the order has closed.  I stress sometimes but it does happen enough to be serious.  Yes I have verified the order has been selected.  I printed OrderTicket() and and OrderCloseTime() to the log and it is for sure an error.  I have only seen in tester but still this makes optimization difficult.
whroeder1
13602
whroeder1 2014.05.26 16:31  
bfis108137: I printed OrderTicket() and and OrderCloseTime() to the log and it is for sure an error.
Are you checking the return value from OrderSelect? What are Function return values ? How do I use them ? - MQL4 forum
Baruch Fishman
705
Baruch Fishman 2014.05.26 17:01  
WHRoeder:
bfis108137: I printed OrderTicket() and and OrderCloseTime() to the log and it is for sure an error.
Are you checking the return value from OrderSelect? What are Function return values ? How do I use them ? - MQL4 forum

Well I am checking but even if I wasn't it wouldn't matter since I use the following line.


Print("t=",OrderTicket()," clsTm=",OrderCloseTime());

Just prior to that line is the line in the log notifying that the stoploss has been reached and that the order has closed and yes the ticket numbers are the same.  To cement it even more I was able to search the history and found the order so that was my workaround but I have found the history not to be the most reliable thing and that orders sometimes take time to reach the history.
whroeder1
13602
whroeder1 2014.05.27 16:48  
It does matter.
  1. If your select fails, you can't call those functions and anything you get is meaningless.
  2. Just because you see in the log that the order closed, doesn't mean OrderCloseTime() has been updated. You must reselect to see the current value.
/
To add comments, please log in or register