Download MetaTrader 5

detect cancellation

To add comments, please log in or register
Having troubles understanding the code? Articles can help you!
chinaski 2011.10.31 23:07 


just try to detect cancelled orders. For this, i use



 All this in an expert advisor. Detection of cancellation is done on every trade.

Now the problem: in OnInit, from is initialized with TimeCurrent.

When i place an order and cancel it, on trade reports always  0 == HistoryOrdersTotal();.

But the order was placed and cancelled AFTER advisor was attached.


When i call


So from == 0, i get a bunch of unwanted orders and last one is that cancellation i am looking for.


So from seems not to work if > 0.


Anyone can help ?
thank you 

Documentation on MQL5: Trade Functions / HistorySelect
Trade Functions / HistorySelect - Documentation on MQL5
chinaski 2011.11.01 00:48  

Solved: Is hould have used TimeTradeServer() instead of CurrentTime().

Documentation on MQL5: Date and Time / TimeTradeServer
Date and Time / TimeTradeServer - Documentation on MQL5
To add comments, please log in or register