Download MetaTrader 5

CTrade::FillingCheck - possible bug introduced since Jan 2013

To add comments, please log in or register
Download MetaTrader 5 and start trading today!
johhny6
130
johhny6 2013.06.17 13:22 

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;
Simon Gniadkowski
Moderator
17998
Simon Gniadkowski 2013.06.17 13:47  
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 

Alain Verleyen
Moderator
30702
Alain Verleyen 2013.06.17 13:59  
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 ?
johhny6
130
johhny6 2013.06.17 13:59  
angevoyageur:
Which error do you get ? INVALID_FILL ?

Yes, 10030.

Alain Verleyen
Moderator
30702
Alain Verleyen 2013.06.17 14:13  
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
johhny6
130
johhny6 2013.06.17 14:23  
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

Alain Verleyen
Moderator
30702
Alain Verleyen 2013.06.17 14:29  
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.
johhny6
130
johhny6 2013.06.17 14:42  
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

Alain Verleyen
Moderator
30702
Alain Verleyen 2013.06.17 14:53  
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 ?
johhny6
130
johhny6 2013.06.17 15:00  
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

Victor Kirillin
491
Victor Kirillin 2013.06.17 15:38  
Please try to re-compile with the changed file and inform us about the result.
Files:
Trade.mqh 53 kb
123
To add comments, please log in or register