Unsupported filling mode

 

I've looked around for an answer but I cannot find anything that works for me. The following doesn't work on meta trader 5:


ZeroMemory(mrequest);

mrequest.action = TRADE_ACTION_DEAL;                                  // immediate order execution

mrequest.price = NormalizeDouble(latest_price.ask,_Digits);           // latest ask price

mrequest.sl = NormalizeDouble(latest_price.ask - STP*_Point,_Digits); // Stop Loss

mrequest.tp = NormalizeDouble(latest_price.ask + TKP*_Point,_Digits); // Take Profit

mrequest.symbol = _Symbol;                                            // currency pair

mrequest.volume = Lot;                                                 // number of lots to trade

mrequest.magic = EA_Magic;                                             // Order Magic Number

mrequest.type = ORDER_TYPE_BUY;                                        // Buy Order

mrequest.type_filling = ORDER_FILLING_FOK;                             // Order execution type

 mrequest.deviation=100;                                                // Deviation from current price

//--- send order

OrderSend(mrequest,mresult);

The error message looks like this:

[Unsupported filing mode] -error: 4756


Now I've also experimented with 

mrequest.type_filling = ORDER_FILLING_IOC; 

and

mrequest.type_filling = ORDER_FILLING_RETURN;

The problem persists.

Also, I added the following:

int FillingMode=(int)SymbolInfoInteger(_Symbol,SYMBOL_FILLING_MODE);

      

      Comment (

           "Filling Mode: ",FillingMode,

         "\nSymbol      : ", SymbolInfoString(_Symbol, SYMBOL_DESCRIPTION),         

         "\nAccount Company: ", AccountInfoString(ACCOUNT_COMPANY),

         "\nAccount Server : ", AccountInfoString(ACCOUNT_SERVER)); 


It prints out:

Filling Mode: 0

Symbol: EUR/USD

Account Company: AMP Global Clearing LLC

Account Server: AMPGlobalClearing-Demo-CQG

 

That is a Futures broker. In that broker, the Forex symbols only exist for informative purposes, but it is not allowed to trade them. Therefore, you can not trade EURUSD, instead you can trade the Future (Euro Fx (Globex)), with Expiration in December 2017 (symbol called 'EU6Z7') or with Expiration in March 2018 (symbol called 'EU6H8') ').

Before sending a trade request, you should check if it is an allowed to trade symbol:


   ENUM_SYMBOL_TRADE_MODE trade_mode = (ENUM_SYMBOL_TRADE_MODE)SymbolInfoInteger(_Symbol, SYMBOL_TRADE_MODE);
  
   //  You can Print the result if you want:  
   //  Print("Symbol Trade Mode = ", EnumToString(trade_mode));
   
   if(trade_mode == SYMBOL_TRADE_MODE_FULL)
   {
      //  Your request
   }


Regards.

 

Check if filling mode is allowed for the symbol.  My broker claims IOC is supported.  But when I checked, only FOK is allowed.  I ran this on both demo and live accounts.  I got the same results.

IF you want FOK, use mrequest.action = TRADE_ACTION_PENDING 


  uint filling=(uint)SymbolInfoInteger(_Symbol,SYMBOL_FILLING_MODE);
  
  if((filling&SYMBOL_FILLING_FOK)==SYMBOL_FILLING_FOK)
   {
    Print("ORDER_FILLING_FOK allowed");
   }
  if((filling&SYMBOL_FILLING_IOC)==SYMBOL_FILLING_IOC)
   {
    Print("ORDER_FILLING_IOC allowed");
   }
  
 
fdeguzman:

Check if filling mode is allowed for the symbol.  My broker claims IOC is supported.  But when I checked, only FOK is allowed.  I ran this on both demo and live accounts.  I got the same results.

IF you want FOK, use mrequest.action = TRADE_ACTION_PENDING 


The problem in this case is that no filling mode is allowed for Forex symbols in that broker.  It is a Futures broker and therefore, it is only allowed to trade in Futures. The Forex symbols have a Trade Mode = SYMBOL_TRADE_MODE_DISABLED,  as I mentioned to @riskreward2017.   You should check if it is allowed to trade that symbol before checking the filling mode.  Regards.


 
Jose Francisco Casado Fernandez:
The problem in this case is that no filling mode is allowed for Forex symbols in that broker.  It is a Futures broker and therefore, it is only allowed to trade in Futures. The Forex symbols have a Trade Mode = SYMBOL_TRADE_MODE_DISABLED,  as I mentioned to @riskreward2017.   You should check if it is allowed to trade that symbol before checking the filling mode.  Regards.



I am having a similar issue, I am new, maybe they are something that I am doing wrong but I looked all previous threads about the invalid filling mode bug without success...


I can trade on the symbol with TRADE_ACTION_PENDING for Buy Limit/Stop/ or Sell Limit/Stop without issue but if I want just to BUY or SELL with TRADE_ACTION_DEAL I always got the invalid filling bug.


here some of my logs before doing trade, init part...


2017.12.25 16:55:01.344 2017.12.01 00:00:00   Account type: ACCOUNT_TRADE_MODE_DEMO

2017.12.25 16:55:01.344 2017.12.01 00:00:00   Trading on this account is allowed

2017.12.25 16:55:01.344 2017.12.01 00:00:00   Automated trading on this account is allowed

2017.12.25 16:55:01.345 2017.12.01 00:00:00   AMP Global Clearing LLC: server AMPGlobalClearing-Demo-CQG

2017.12.25 16:55:01.348 2017.12.01 00:00:00   Symbol Informations for EURJPY

2017.12.25 16:55:01.348 2017.12.01 00:00:00       StopsLevel: 0 pips, FreezeLevel: 0 pips

2017.12.25 16:55:01.348 2017.12.01 00:00:00       Digits: 3, Point: 0.001

2017.12.25 16:55:01.348 2017.12.01 00:00:00       SpreadFloat: true, Spread(current): 2 pips

2017.12.25 16:55:01.348 2017.12.01 00:00:00       Limitations for trade operations: SYMBOL_TRADE_MODE_FULL (Full access)

2017.12.25 16:55:01.348 2017.12.01 00:00:00       Trades execution mode: SYMBOL_TRADE_EXECUTION_MARKET (Execution of orders on the market)

2017.12.25 16:55:01.348 2017.12.01 00:00:00       Contract price calculation: SYMBOL_CALC_MODE_FOREX (Calculation of profit and margin for Forex)

2017.12.25 16:55:01.348 2017.12.01 00:00:00       Standard contract size: 100000.0 (EUR)

2017.12.25 16:55:01.348 2017.12.01 00:00:00       LotsMin: 0.01  LotsMax: 10000.0  LotsStep: 0.01

2017.12.25 16:55:01.705 2017.12.01 00:00:01   failed market sell 0.05 EURJPY sl: 133.861 tp: 134.061 [Unsupported filling mode]


I use the GetFilling function that someone posted on this forum, I also tried all the filling mode without any success..

someone know what could be the issue? if I do PENDING buy/sell limit no problem...

 
labidus:

Forum on trading, automated trading systems and testing trading strategies

Opening sell position in mql5

fxsaber, 2017.12.12 21:56

// true - not for trade by market-orders
bool IsBadFilling( const string Symb )
{
  return(!(SymbolInfoInteger(_Symbol, SYMBOL_FILLING_MODE) & (SYMBOL_FILLING_IOC | SYMBOL_FILLING_FOK)));
}

void OnTick()
{
  if (IsBadFilling(_Symbol))
  {
    Print("Change symbol " + _Symbol + " or server " + AccountInfoString(ACCOUNT_SERVER) + " for trade by market!");
    
    ExpertRemove();    
  }
}


Result

2017.12.05 00:00:00   Change symbol EURUSD or server AMPGlobalClearing-Demo-CQG for trade by market!
 

If I use this function, well the corrected one that is not buggy (parameter is useless) :)

bool CMMTrade::IsBadFilling(const string symbol) const

{

    return !(SymbolInfoInteger(symbol, SYMBOL_FILLING_MODE) & (SYMBOL_FILLING_IOC | SYMBOL_FILLING_FOK));

}


None of the symbol is supposed to work on that server... why PENDING action work? 


If I need to test BUY and SELL what DEMO server should I use?


Also If I try to make a BUY or SELL on pending mode, well no error but nothing append, no error, no log, nothing, its why I was trying to use DEAL since all example outthere use that...

 
labidus:

If I need to test BUY and SELL what DEMO server should I use?

Forum on trading, automated trading systems and testing trading strategies

Opening sell position in mql5

fxsaber, 2017.12.12 21:56

2017.12.05 00:00:00   Change symbol EURUSD or server AMPGlobalClearing-Demo-CQG for trade by market!
 

Well I suppose its clear for you but not for me


2017.12.27 16:24:19.965 2017.12.01 00:00:00   Symbol Informations for USDJPY

2017.12.27 16:24:19.965 2017.12.01 00:00:00       StopsLevel: 0 pips, FreezeLevel: 0 pips

2017.12.27 16:24:19.965 2017.12.01 00:00:00       Digits: 3, Point: 0.001

2017.12.27 16:24:19.965 2017.12.01 00:00:00       SpreadFloat: true, Spread(current): 1 pips

2017.12.27 16:24:19.965 2017.12.01 00:00:00       Limitations for trade operations: SYMBOL_TRADE_MODE_FULL (Full access)

2017.12.27 16:24:19.965 2017.12.01 00:00:00       Trades execution mode: SYMBOL_TRADE_EXECUTION_MARKET (Execution of orders on the market)

2017.12.27 16:24:19.965 2017.12.01 00:00:00       Contract price calculation: SYMBOL_CALC_MODE_FOREX (Calculation of profit and margin for Forex)


This tell me that I can trade FULL ACCESS on that server.

If I cannot, what server should I use?


Because your response and tell nothing but just CHANGE SERVER ... so what server should I use to test? its what I asked previously

 
labidus:

Because your response and tell nothing but just CHANGE SERVER ... so what server should I use to test? its what I asked previously

FIBOGroup-MT5 Server
ICMarkets-Demo
FXOpen-MT5
MetaQuotes-Demo
...
 

ok thanks, now I can test what I wanted :), the default DEMO server from MetaTrader5 is not so usefull!

Reason: