I'm am experiencing a problem with the update of the status or orders in terminal (and hence in my EA). An extract of the Journal follows for clarity:
It can be seen that at 2019.05.03 11:30:22.970 the order was activated. However, my EA, which looks at OrderType() to determine whether a pending order has been activated or not, determined that the order (in this case order #93112412) was still of the type OP_BUYLIMIT (value = 2). Therefore, as could be seen in the extract of the Journal above, my EA continued to attempt to modify the apparent pending order even though it was in fact already activated. The apparent "Pending Status" of this order could also be confirmed in the Terminal Window where order #93112412 was shown as still Pending! Restarting / re-loading the EA did not help as the order type was still incorrectly shown in the MT4 Terminal window.
The only solution I could find to this problem so far was to completely shutdown and restart MetaTrader after which my EA was successfully able to re-load all orders and the correct status of order (i.e. type OP_BUY, value = 0) was identified. After the MT4 restart this order was also shown correctly as an activated order and no longer as a pending order in the terminal window.
I know this problem has been encountered before (refer to the following link):
But I couldn't find a suitable solution that is applicable to my case.
Can anyone who has had this problem and has found a solution, other than restarting MT4, let me know how they dealt with it please? For, example, is there a way to force synchronization of the order status shown in the terminal with the server, from my EA, without having to restart MT4?
There is no solution until Metaquotes fixes the terminal.
You could kludge a batch file that repeatedly restarts the terminal and use TerminalClose - Common Functions - MQL4 Reference to resync.