Thanks for your awesome MT4-MT5 trade module - it’s made MT5 infinitely more appealing to MT4 users!
Unfortunately, it seems that the order history functionality of MT4Orders is broken
I’ve been running various EAs under the 13.11.2016 version for a while, but only just needed to check order history in a new EA, and it returned incorrect information in the tester.
I used this example code in the OnTick function of the parent .mq5 file to track what was happening:
Comment("Open trades: ", OrdersTotal(), OrdersToString(), "\n", "Closed trades: ", OrdersHistoryTotal(), OrdersToString(MODE_HISTORY));
After opening a trade, the chart shows this:
…but when the trade closes-out, this is displayed, so it’s seeing the correct number of history entries, but only retrieving / duplicating details of the 1st (balance) entry:
I saw that the latest (14.06.2017) version of MT4Orders was available and gave that a try, but a similar problem exists - when the trade closes-out, the chart shows:
…so it’s now showing an incorrect history count too
However, if I open 2 orders then the chart shows this (the history count is wrong and the balance entry is no longer displayed):
…and when both trades close, they report correctly in the history, but the balance entry is still missing and the history count is still wrong:
I’m hoping that there’s a quick fix for this as I’ve tried checking the code and can’t see what’s causing it.