CTrade::FillingCheck - possible bug introduced since Jan 2013

 

Hi there,


I have EA's working since Jan 2013, compiled back then OK, and running in market without problem since.


However re-compile same Jan 2013 code with latest MT5 compiler, gives me errors in market.


Code has not changed.


I traced it to maybe the CTrade::FillingCheck.


This EA is using Limit orders successfully, however now it no longer works.

Using IOC and Limit orders - please help!!

If I use the EA compiled in January 2013, on live MT5, it works fine. But I want to change code and recompile!


Debug through the below code:


exec = SYMBOL_TRADE_EXECUTION_MARKET

m_request.action = TRADE_ACTION_PENDING

Meaning it passes if(exec), but then fails m_request, and gives error.


bool CTrade::FillingCheck(const string symbol)

... // lines removed here. code gets to below then jumps to error.

//--- check execution mode again
   if(exec==SYMBOL_TRADE_EXECUTION_MARKET)
     {
      //--- for the MARKET execution mode
      //--- analyze order
      if(m_request.action!=TRADE_ACTION_PENDING)
        {
         //--- in case of instant execution order
         //--- if the required filling policy is supported, add it to the request
         if(m_type_filling==ORDER_FILLING_FOK && (filling & SYMBOL_FILLING_ALL_OR_NONE)!=0)
           {
            m_request.type_filling=m_type_filling;
            return(true);
           }
         if(m_type_filling==ORDER_FILLING_IOC && (filling & SYMBOL_CANCEL_REMAIND)!=0)
           {
            m_request.type_filling=m_type_filling;
            return(true);
           }
        }
      //--- wrong filling policy, set error code
      m_result.retcode=TRADE_RETCODE_INVALID_FILL;
 
johhny6:

Hi there,

I have EA's working since Jan 2013, compiled back then OK, and running in market without problem since.

However re-compile same Jan 2013 code with latest MT5 compiler, gives me errors in market.

<CODE DELETED>

When posting code please use the   SRC   button : How to use the   SRC   button. 

1st post edited using SRC 

 
johhny6:

Hi there,


I have EA's working since Jan 2013, compiled back then OK, and running in market without problem since.


However re-compile same Jan 2013 code with latest MT5 compiler, gives me errors in market.

...

Meaning it passes if(exec), but then fails m_request, and gives error.

...
Which error do you get ? INVALID_FILL ?
 
angevoyageur:
Which error do you get ? INVALID_FILL ?

Yes, 10030.

 
johhny6:

Yes, 10030.

Then your broker may have change the specifications of the symbol, check it by right clicking on your symbol in Market Watch, then Specification..., on get a window like this :

Is this IOC ?

Documentation on MQL5: Standard Constants, Enumerations and Structures / Environment State / Symbol Properties
Documentation on MQL5: Standard Constants, Enumerations and Structures / Environment State / Symbol Properties
  • www.mql5.com
Standard Constants, Enumerations and Structures / Environment State / Symbol Properties - Documentation on MQL5
 
angevoyageur:

Then your broker may have change the specifications of the symbol, check it by right clicking on your symbol in Market Watch, then Specification..., on get a window like this :

Is this IOC ?

It says: "Immediate or Cancel"

Expiration is: GTC, Today, Specified

Orders is: All


The old code in .ex5 / binary form from Jan 2013, works fine.

If i take the code, and recompile, it gives me filling error - same broker, same terminal, same code but newer compile date

IOC

 
johhny6:

It says: "Immediate or Cancel"

Expiration is: GTC, Today, Specified

Orders is: All


The old code in .ex5 / binary form from Jan 2013, works fine.

If i take the code, and recompile, it gives me filling error - same broker, same terminal, same code but newer compile date


I don't see the problem, you have to write to ServiceDesk and provide them your code and probably the logs.
Get in touch with developers using Service Desk!
Get in touch with developers using Service Desk!
  • www.mql5.com
We therefore attach great importance to all user reports about issues in our programs and try to answer each one of them.
 
angevoyageur:
I don't see the problem, you have to write to ServiceDesk and provide them your code and probably the logs.

Ok, will do.


Maybe it has something with the EXECUTION_MARKET bit, that is new since Jan 2013 yes?


debugger example:

debugger variables

 
johhny6:

Ok, will do.


Maybe it has something with the EXECUTION_MARKET bit, that is new since Jan 2013 yes?


debugger example:


Can you show the code of your EA where you are using IOC ?
 
angevoyageur:
Can you show the code of your EA where you are using IOC ?

Sure

in OnInit()

         o_trade.SetTypeFilling(ORDER_FILLING_IOC);

         o_trade.SetDeviationInPoints(Slippage);

- here is call to CTrade object

               tradeOK=o_trade.BuyLimit(TradeSizeOptimized(),ask_price,_Symbol,SL,TP,ORDER_TIME_GTC,0,"my comment");

also debugger shows IOC (below)

ioc

 
Please try to re-compile with the changed file and inform us about the result.
Files:
Trade.mqh  53 kb
Reason: