Does the code below works fine with Gold (XAUUSD) ?

 

Hello, 

One question please.

Does the code below works fine with Gold (XAUUSD) ?


double MyPoint = Point;
//+------------------------------------------------------------------+
//| Expert initialization function
//+------------------------------------------------------------------+
int OnInit() {    if(Digits == 3 || Digits == 5) MyPoint = Point * 10; //---    return(INIT_SUCCEEDED); }

 

 

Thanks for all 

 
Mohammad Soubra:

Hello, 

One question please.

Does the code below works fine with Gold (XAUUSD) ?

 

 

Thanks for all 

Print("GOLD: ",DoubleToString(Digits()));


Maybe it does nothing if it's neither 3 or 5

 
Marco vd Heijden:


Maybe it does nothing if it's neither 3 or 5

So, the gold is 2 digits ...

Then, what to use, Point * 1 only ??? 

 
Mohammad Soubra:

So, the gold is 2 digits ...

Then, what to use, Point * 1 only ??? 

if(_Symbol == "XAUUSD") MyPoint = Point * 10;
 
Ernst Van Der Merwe:
Oh... thanks mate
Great

But does it work with any broker?
 
Mohammad Soubra:
Oh... thanks mate
Great

But does it work with any broker?

Most brokers have 2 digit Gold prices, but to be sure:

if(_Symbol == "XAUUSD" && Digits == 2) MyPoint = Point * 10;
 
Ernst Van Der Merwe:

Most brokers have 2 digit Gold prices, but to be sure:

Thanks for your repeat
Same what I am using you have repeated
But thanks a lot


 
What about S&P500 or NasDaq or .... bla bla bla
Any body has good idea?