Because of this: https://en.wikipedia.org/wiki/Double-precision_floating-point_format
Please read the documentation carefully : Print()
Data of double type are shown with the accuracy of up to 16 digits after a decimal point, and can be output either in traditional or in scientific format, depending on what entry will be more compact. Data of float type are output with 5 digits after a decimal point. To output real numbers with another accuracy or in a predefined format, use the PrintFormat() function.
See also these topics Can price != price ?, what is a double ?
Floating point has infinite number of decimals,
it's your not understanding floating point and that some numbers can't be represented exactly. (like 1/10.) Double-precision floating-point format - Wikipedia, the free encyclopedia
double t = 10/81.; Print(DoubleToString(t,15)); // tests USDCHF,H1: 0.123456790123457See also The == operand. - MQL4 forum
You are missing trading opportunities:
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
Registration
Log in
You agree to website policy and terms of use
If you do not have an account, please register
I have an issue when using several candle prices.If I use:
Print(Close[33]);
to print the value of a given candle, I get: 2016.05.04 11:17:55.733 Indicator - CADCHF,M15: 0.7507200000000001
This happens occasionally with some candles, not all.
I've tried to limit the number of decimals, but still get the same:
Print(NormalizeDouble(Close[34],Digits)+" "+MarketInfo(Symbol(), MODE_DIGITS));
and get 2016.05.04 11:17:55.736 Indicator - CADCHF,M15: 0.7507200000000001 5
I've also check the History Center to see if the price data base was corrupt, but it shows 0.75072
I've also restarted MT4, but get the same result.
I've checked around in the internet and have not bee able to find anything related to this issue.
Does anybody have any idea why this may be happening?