How to know if the asset is Fx, CFD, Futures?

Reza nasimi
523
Reza nasimi  

Hi

I need to recognize if the symbol belongs to fx, CFD or Futures.

Should I used this?

MarketInfo(_Symbol, MODE_PROFITCALCMODE)

Is profit calc mode the correct way to figure it out?

Please note that I want to do it programmatically.

Any help would be appreciated.


Added later:

Let me explain more about my question.

in the document I see this:

MODE_PROFITCALCMODE

27

Profit calculation mode. 0 - Forex; 1 - CFD; 2 - Futures


And it seems to me that it gives me what I can see in the specification window of MT4 under the same title.

But when I checked another broker's MT4 where the futures are provided too, I realized that for the futures the Profit Calculation mode is CFD  in the specification window. (For all the symbols that I have checked, maybe not correct for everything).

I also have found :

SYMBOL_PATH

Path in the symbol tree

string


But in some cases the path name does not contain any of the words FX/Forex, CFD or futures.

My question is what is the trustable way of recognizing if it is FX, CFD or Futures.


Regards

Documentation on MQL5: Constants, Enumerations and Structures / Environment State / Symbol Properties
Documentation on MQL5: Constants, Enumerations and Structures / Environment State / Symbol Properties
  • www.mql5.com
To obtain the current market information there are several functions: SymbolInfoInteger(), SymbolInfoDouble() and SymbolInfoString(). The first parameter is the symbol name, the values of the second function parameter can be one of the identifiers of ENUM_SYMBOL_INFO_INTEGER, ENUM_SYMBOL_INFO_DOUBLE and ENUM_SYMBOL_INFO_STRING. Some symbols...
Marco vd Heijden
Moderator
13058
Marco vd Heijden  
It's best to ask your broker about this directly.
Reza nasimi
523
Reza nasimi  
Marco vd Heijden:
It's best to ask your broker about this directly.
Thank you very much for replying.

The EA might work on different brokers MT4.
But, I think your answer means there is no direct method to having this info working for all the brokers.
Then I think I have to work on a combination of SYMBOL_PATH and MODE_PROFITCALCMODE checking.


Tank you very much Marco vd Heijden