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
- Flexible MetaTrader 5 trading system with all order types
- MetaTrader 5 for your employees
- When MetaTrader 5 Web Terminal is indispensable
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

You are missing trading opportunities:
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
Registration
Log in
You agree to website policy and terms of use
If you do not have an account, please register