Does anyone know whats wrong with this mt4 code?

To add comments, please log in or register
rld280
8
rld280  

Print("BuyOrdersArray good[1] " +BuyOrdersArray[1]);//digits are 5 like it is supposed to be

Print("BuyOrdersArray good[1] " +BuyOrdersArray[variable here]);//now it goes to 4 digits when you add a variable instead of an integer you can make the code the same but as soon as you put the variable in for the array location it messes up

Carl Schreiber
Moderator
10871
Carl Schreiber  
William Roeder
23227
William Roeder  

Floating-point has an 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

If you want to see the correct number of digits, convert it to a string with the correct/wanted accuracy.
          question about decima of marketinfo() - MQL4 programming forum 2016.05.18

To add comments, please log in or register