I monitor OnTrade events after Market buy/sell command.
In almost case is OK, but sometimes program cannot detect the "history of deals" changes in OnTrade events.
It is seemed to happen when MT5 take some seconds to open the position.
MT5 sometimes skip the OnTrade events even though "history of deals" is changed when busy.
Please check condition of OnTrade events.
PS. You can use the test EA to reproduce that I sent before. (https://www.mql5.com/en/forum/1964)