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

You are missing trading opportunities:
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
Registration
Log in
You agree to website policy and terms of use
If you do not have an account, please register
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