Why predefined variable "Point" is 0 when using a sub-pip broker?

 

Today, I updated MT4 to the latest version (build 222) and noticed that the predefined variable "Point" returns 0 when using a sub-pip broker (such as United World Capital, which is the default demo broker in 222 build).


MarketInfo(Symbol(), MODE_POINT) also returns 0. As as result, any code that uses the "Point" variable in its calculations will break.


"Bid" and "Ask" predefined variables don't show sub-pip values.


Is this a bug?


PS. The above is true for EURUSD, for USDJPY the point value is 0.001.


Thanks,

Lukasz

 

How many digits in your broker's price?

Actually, try

int dig = MarketInfo("EURUSD",MODE_DIGITS);

Print("Point - ", DoubleToStr(MarketInfo("EURUSD",MODE_POINT),dig));

 

Yup - this one looks like a MetaTrader code defect, too. I noticed this issue with another broker. I work around this issue with a function:


double FX.Point()
{ if(StringFind(Symbol(),"JPY") > (-1)) return(0.001); return(0.00001); }


Hope that helps,

Raider

 
Roger:

How many digits in your broker's price?

Actually, try

int dig = MarketInfo("EURUSD",MODE_DIGITS);

Print("Point - ", DoubleToStr(MarketInfo("EURUSD",MODE_POINT),dig));

Roger,


MarketInfo("EURUSD", MODE_DIGITS), as well as the predefined variable "Digits" returns 5

MarketInfo("EURUSD", MODE_POINT), as well as the predefined variable "Point" returns 0


MarketInfo("USDJPY", MODE_DIGITS), as well as the predefined variable "Digits" returns 3

MarketInfo("USDJPY", MODE_POINT), as well as the predefined variable "Point" returns 0.001


As you can see, values for "EURUSD" are reported incorrectly. I think this is the broker's fault, who provides incorrect data.


Thanks,

Lukasz

 
Raider:

Yup - this one looks like a MetaTrader code defect, too. I noticed this issue with another broker. I work around this issue with a function:


double FX.Point()
{ if(StringFind(Symbol(),"JPY") > (-1)) return(0.001); return(0.00001); }


Hope that helps,

Raider


Thanks Raider for this suggestion, but it doesn't solve the original issue. I would have to change the code, and the above wouldn't work for a normal pip broker (where point size is 10 times that).

 
lukasz74nj:

Thanks Raider for this suggestion, but it doesn't solve the original issue. I would have to change the code, and the above wouldn't work for a normal pip broker (where point size is 10 times that).



Hey Lukasz,


The issue that we were seeing is a result of the way the Print function works - it's truncating doubles after the 4th decimal place. Try Roger's suggestion - using DoubleToStr() is the answer.


Watching out for "intuitive" code features,

Raider

 
Raider:


Hey Lukasz,


The issue that we were seeing is a result of the way the Print function works - it's truncating doubles after the 4th decimal place. Try Roger's suggestion - using DoubleToStr() is the answer.


Watching out for "intuitive" code features,

Raider


Yes, that's correct. Thanks Raider!

Reason: