detect cancellation

 

Hello,

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

HistorySelect(from,TimeCurrent());

HistoryOrdersTotal();

 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

HistorySelect(0,TimeCurrent())

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
  • www.mql5.com
Trade Functions / HistorySelect - Documentation on MQL5
 

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

Documentation on MQL5: Date and Time / TimeTradeServer
  • www.mql5.com
Date and Time / TimeTradeServer - Documentation on MQL5