Download MetaTrader 5
To add comments, please log in or register
Do you know that MQL5 is an object-oriented language?
chinaski
823
chinaski 2011.10.31 23:07 

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
chinaski
823
chinaski 2011.11.01 00:48  

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
/
To add comments, please log in or register