OrdersHistoryTotal not reading history when starting EA - page 2

 
Keith Watford:

OrdersHistory is not guaranteed to be in chronological order. If you want to filter by time, then filter by only checking trades that opened or closed after a particular time.

Thank you for this (to me) new info :)

I will use this logic to try a few things, hopefully I can sort this out from here!

 
Keith Watford:

OrdersHistory is not guaranteed to be in chronological order. If you want to filter by time, then filter by only checking trades that opened or closed after a particular time.

Thanks to your pointers I think I worked it out using:

timeWindowLimitBackwards = 8760; //One year

OrderOpenTime() > iTime(NULL,0,timeWindowLimitBackwards)

Is there anything that doesnt make sense to you with this solution? Just dont want to run errors I cant see due to lack of experience with MQL4 :)


Thanks again mate!

Reason: