i have a problem that i can't get history orders in some situations.
Basically i want to log my orders. For this, in OnTrade, i cycle over latest history:
for(oh=1;oh < HistoryOrdersTotal();oh++)
if(ticket > 0)
case a) open order with stop and or target, close order
After close order, OnTrade is called and code above reflects history order for close
case b) open order with stop and or target, modify stop and or target, close order
After close order, OnTrade is called and code above DOES NOT reflect history order for close
In both cases, i can see history of close order in history panel of MT5 (deals excluded)
Anyone has an idea what's going wrong ?
no comment from experts ?
Still a bug
Regarding case b) - have you tried to first verify the result of modification? Because in this case, I would expect 2 trade events for OnTrade() to handle:
1. First - the event of modifying the order
2. Second - the event of closing the order
See more in -> https://www.mql5.com/en/articles/232