MQL5 equivalent for MarketInfo(_Symbol, MODE_PROFITCALCMODE)

 

Hello,

What is the MQL5 equivalent for MarketInfo(_Symbol, MODE_PROFITCALCMODE) please?

My goal is to have the type of the symbol (forex, CFD...). I tried the SymbolInfoString(_Symbol,SYMBOL_PATH,path) command, but it doesn't work well with all brokers.

Regards,

Matthieu

 
Matthieu Jean Baptiste Wambergue:

Hello,

What is the MQL5 equivalent for MarketInfo(_Symbol, MODE_PROFITCALCMODE) please?

My goal is to have the type of the symbol (forex, CFD...). I tried the SymbolInfoString(_Symbol,SYMBOL_PATH,path) command, but it doesn't work well with all brokers.

Regards,

Matthieu

Should be:

                    switch((int)::SymbolInfoInteger(symbol, SYMBOL_TRADE_CALC_MODE))
                    {
                        case SYMBOL_CALC_MODE_FOREX:                return(0.0);
                        case SYMBOL_CALC_MODE_CFD:                  return(1.0);
                        case SYMBOL_CALC_MODE_FUTURES:              return(2.0);
                        default:                                    return(-1.0);
                    }
 
Dominik Egert #:

Should be:

Hi Dominik,

Thank you very much for this answer!

Regards,

Matthieu

Reason: