Possible bug with OnTradeTransaction event handler

 

I've come across an issue that's a bit strange, the code below is able to tell anytime a pending order is deleted/cancelled on the chart. Outside tester the result.order field carries the ticket of the pending order that was cancelled, but if you run this same code on the strategy tester the result.order field is always equal to 0.

void OnTradeTransaction(const MqlTradeTransaction& trans,
                        const MqlTradeRequest& request,
                        const MqlTradeResult& result)
  {
//---
   if (trans.type == TRADE_TRANSACTION_REQUEST)
   {
    if (request.action == TRADE_ACTION_REMOVE && result.retcode == 10009)
    {
     Print(" Order deleted! magic ",request.magic," result ticket ",result.order);
    }
   }
  }

Is this a bug on mql5 side or am I missing something, please advice.

 
Attached is the full EA, in case you'd like to test it, the EA creates a pending order and deletes it shortly afterward so you can observe the trade transaction issue, outside tester the resul.order field has the ticket of the deleted pending order, but on strategy tester the result.order field is always equal to 0.
 
Hi, anyone had time to look at this yet?
 
same issue hmmm
 
uriyaz:
same issue hmmm
Yes,  it's a clear issue,  but all of a sudden all moderators have gone mute.  Will try to post on the Russian forum, will likely get more activity there. 
 
Chidera Anakpe #:
Yes,  it's a clear issue,  but all of a sudden all moderators have gone mute.  Will try to post on the Russian forum, will likely get more activity there. 

I also found same issue which you mention. interesting was that only Pending order delete in Test env get zero on order ticket.

https://www.mql5.com/en/forum/386661

Hope MQL will fix this issue as it is not broker depended.

Found Bug: Order ticket is zero in TRADE_TRANSACTION_REQUEST msg for Pending order delete transaction
Found Bug: Order ticket is zero in TRADE_TRANSACTION_REQUEST msg for Pending order delete transaction
  • www.mql5.com
Would like to contribute to improve MT5, where do I report found bug...