Digits, MODE_DIGITS, SYMBOL_DIGITS

 

Hi MQL4/5,

 

As you will see from the nature of my question, I am new to coding and am currently stuck on how and where to use 3 different versions of the 'Digits'. That being "Digits", "MODE_DIGITS" and "SYMBOL_DIGITS".

How are each of these used?

I have a section of my program that checks the decimal place accuracy of the pair and I have used the predefined variable Digits

if (Digits==5)

{Pair=10000;}

else

{Pair=100;}

 

But I would like to know in what instances I would have used the other two variations of this.

One more thing - How do I attach a section of my program to a post.

 

Mark

 

Digits() is only for current symbol (chart symbol).

MODE_DIGITS is to be used with MarketInfo(), it can be used to find the value for any symbol.

SYMBOL_DIGITS is to be used with SymbolInfoInteger(), it's the same usage as MarketInfo() but comes from mql5 for compatibility reason.

 
Alain Verleyen:

Digits() is only for current symbol (chart symbol).

MODE_DIGITS is to be used with MarketInfo(), it can be used to find the value for any symbol.

SYMBOL_DIGITS is to be used with SymbolInfoInteger(), it's the same usage as MarketInfo() but comes from mql5 for compatibility reason.

Thanks for your assistance once again Alain. I really appreciate help from experienced coders because even though the MQL Book is very helpful, it's still quite hard to understand if you don't come from a programming background.

 

mark 

 
Mark Falzon:

Thanks for your assistance once again Alain. I really appreciate help from experienced coders because even though the MQL Book is very helpful, it's still quite hard to understand if you don't come from a programming background.

 

mark 

You are welcome.
 
Mark Falzon:

Hi MQL4/5,

 

As you will see from the nature of my question, I am new to coding and am currently stuck on how and where to use 3 different versions of the 'Digits'. That being "Digits", "MODE_DIGITS" and "SYMBOL_DIGITS".

How are each of these used?

I have a section of my program that checks the decimal place accuracy of the pair and I have used the predefined variable Digits

if (Digits==5)

{Pair=10000;}

else

{Pair=100;}

 

But I would like to know in what instances I would have used the other two variations of this.

One more thing - How do I attach a section of my program to a post.

 

Mark

Not sure about the rest of the stuff, but it seems Alain has already answered.  As far as attaching a section of your program, I would suggest Copy and Paste (Ctrl+C and Ctrl+V respectively in Windows).
Reason: