Get Hedging information

 

Hi,


Can someone knows how get information about account info Hedging possibilities in mql5 ?


Thank you !

Ghen

 

Forum on trading, automated trading systems and testing trading strategies

Is this the proper way to check if an account is a hedging account?

Jose Francisco Casado Fernandez, 2017.09.30 01:46

Yes, it's all right.  Also, you can use a separate function like this:

int OnInit()
  {
    if (!IsHedging) {
    Print("This is not a hedging account. This EA can only be run on hedging accounts!");
    return (INIT_FAILED);
    }
    
    return(INIT_SUCCEEDED);
  }

//+------------------------------------------------------------------+

bool IsHedging() 
{ 
  
  ENUM_ACCOUNT_MARGIN_MODE  margmod = (ENUM_ACCOUNT_MARGIN_MODE)AccountInfoInteger(ACCOUNT_MARGIN_MODE);
  return(margmod==ACCOUNT_MARGIN_MODE_RETAIL_HEDGING); 

}

//+------------------------------------------------------------------+

Reason: