MQL5 IC Market

 

I have a little challenge. When I for example use OctaFX or MT5 from this website does my code works. But in IC Market does this code not work.

trade.PositionClose

Type of account is hedging. The code error is 4756

Also if I open an order with 

#include<Trade\Trade.mqh>

trade.Buy(0.1)

I can not use default settings as ORDER_FILLING_RETURN but need to use ORDER_FILLING_IOC before it will open an order. 

Anybody have any idea why this simple code not works with IC Market?

 
hasle1975 :

I have a little challenge. When I for example use OctaFX or MT5 from this website does my code works. But in IC Market does this code not work.

trade.PositionClose

Type of account is hedging. The code error is 4756

Also if I open an order with 

#include<Trade\Trade.mqh>

trade.Buy(0.1)

I can not use default settings as  ORDER_FILLING_RETURN but need to use  ORDER_FILLING_IOC before it will open an order. 

Anybody have any idea why this simple code not works with IC Market?


Example:  

//+------------------------------------------------------------------+
//| Expert initialization function                                   |
//+------------------------------------------------------------------+
int OnInit()
  {
...
//---
   if(!m_symbol.Name(Symbol())) // sets symbol name
      return(INIT_FAILED);
   RefreshRates();
//---
   m_trade.SetExpertMagicNumber(m_magic);
//---
   if(IsFillingTypeAllowed(SYMBOL_FILLING_FOK))
      m_trade.SetTypeFilling(ORDER_FILLING_FOK);
   else if(IsFillingTypeAllowed(SYMBOL_FILLING_IOC))
      m_trade.SetTypeFilling(ORDER_FILLING_IOC);
   else
      m_trade.SetTypeFilling(ORDER_FILLING_RETURN);
//---
...

...

//+------------------------------------------------------------------+ 
//| Checks if the specified filling mode is allowed                  | 
//+------------------------------------------------------------------+ 
bool IsFillingTypeAllowed(int fill_type)
  {
//--- Obtain the value of the property that describes allowed filling modes 
   int filling=m_symbol.TradeFillFlags();
//--- Return true, if mode fill_type is allowed 
   return((filling & fill_type)==fill_type);
  }
 
My account it doesn't trade I don't know what should I do now can anyone help me please