I get the open price value from the selected position. Assume that the selected position price I got is 0.20 Then I sum it up with 0.1. So, I got 0.30 for the first calculation. When I do it multiple times until the value is 0.50. When I do the calculation for 0.5 (plus with 0.1 again), I got 0.5000000001. What was happenned and what should I do to deal with this situation.
Thank you
- Any questions from newcomers on MQL4 and MQL5, help and discussion on algorithms and codes
- My brain can't take it anymore As a Novice
- How do I close all orders at total profit in pips?
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-precision floating-point format - Wikipedia, the free encyclopedia
See also The == operand. - MQL4 programming forum
Print out your values to the precision you want with DoubleToString - Conversion Functions - MQL4 Reference.
William Roeder:
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
Thank you for sharing. Appreciate :)
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
See also The == operand. - MQL4 programming forum
Print out your values to the precision you want with DoubleToString - Conversion Functions - MQL4 Reference.
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