You have to understand the principle of double and floats and the difference in the way they exist an the way they are presented to you (most of the time in a rounded version by DoubleToString(..)) and why most of the comparisons of the equality of two double fails!
For example read this thread.
The second thing is to understand the decimal numbers of the prices. Practically every broker can do and does what he wants or what seems to be good for him. :(
Read for example this or that thread. "Decades ago" the prices had 4 decimals, just Yen had two, now most of them had 5 and Yen 3 decimals. Check the specs of your broker!!
Floating-point arithmetic - Wikipedia
- en.wikipedia.org
In computing, floating-point arithmetic is arithmetic using formulaic representation of real numbers as an approximation so as to support a trade-off between range and precision. For this reason, floating-point computation is often found in systems which include very small and very large real numbers, which require fast processing times. A...
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
Hey everyone,
am trying to learn the language of MQL4 (I'll get to MQL5 later)
have an issue with one of the programs in the book.
https://book.mql4.com/programm/samples
the program possible.mq4 has a floating-point type "double" in it.
But when running it, it only gives 4 digits after the dot,
instead of the 5 digits after the dot that the Currency USDCHF has.
I have tried to make a float of it, but that failed also.
Can someone explain to me why the result is different then the actual digits.
kind regards,
Th