Some functions are not working in MT5 Tester

 
Hello,
I made an EA, it works fine in Demo account, but not in Tester.
I checked the reason, I found some functions are not working in MT5 tester.

1) I use CTrade class that is provided in MetaQuotes.
   I open a position by "CTrade::PositionOpen" function, but "m_result.deal" is never set by tester.
   Even though "m_result.retcode" is set to "TRADE_RETCODE_DONE" by tester,  "m_result.deal" will be "0" forever.


2) In OnTrade events, I check my pending order by below function.
   When pending order is filled, it should return "ORDER_STATE_FILLED".
   Actually in demo, it returns correct status.
   But in tester, it returns  "ORDER_STATE_PLACED".

   ---------- Code start ---------
   long PendingOrderStatus(ulong myPendingOrderTicket)
    {
      if (HistoryOrderSelect(myPendingOrderTicket)==false) return(-1);
      long sts = HistoryOrderGetInteger(myPendingOrderTicket,ORDER_STATE);
      return( sts );
    }
   ---------- Code end ---------

Please check it.

Documentation on MQL5: Standard Constants, Enumerations and Structures / Trade Constants / Order Properties
  • www.mql5.com
Standard Constants, Enumerations and Structures / Trade Constants / Order Properties - Documentation on MQL5
 

Hi,

 

I had the same problem, I thought I was doing something wrong!!! I'm trying to use Buy Stop Orders and I have to constantly monitor them to see if they got filled, but is impossible to test the EA because they never change state.

 Any Solutions???

 

Hoy can you test a EA with pending orders if they don't change state.

 

Please help!!!!! 

Documentation on MQL5: Standard Constants, Enumerations and Structures / Trade Constants / Order Properties
  • www.mql5.com
Standard Constants, Enumerations and Structures / Trade Constants / Order Properties - Documentation on MQL5