MQL4 - automated forex trading   /  

Forum

NormalizeDouble function

Back to topics list To post a new topic, please log in or register

avatar
17
cleon 2006.01.18 15:49 
Hello,

MQL rounds decimal numbers like 112.80 to 112.8 automatically (at least it looks like), but I need the value to be shown like 112.80 (with the zero), so I tried to use normalizedouble function with 2 digits (or 4 to the other pairs), but it only shows 1 digits when the last digit is a 0 (zero). How can I force to always show .00 or .0000 in any value in any currency ? I already used "Digits" on NormalizeDouble so it can match the current pair and nothing.

Thank you.
Cleon
To Sleep, or Not to Sleep?

To Sleep, or Not to Sleep?

An alternative use of the Sleep() function in the realization of pauses between EA's actions is proposed. The approach under consideration allows a smart use of machine time.


avatar
90
Michal 2006.01.18 19:36 
cleon:
Hello,

MQL rounds decimal numbers like 112.80 to 112.8 automatically (at least it looks like), but I need the value to be shown like 112.80 (with the zero), so I tried to use normalizedouble function with 2 digits (or 4 to the other pairs), but it only shows 1 digits when the last digit is a 0 (zero). How can I force to always show .00 or .0000 in any value in any currency ? I already used "Digits" on NormalizeDouble so it can match the current pair and nothing.

Thank you.
Cleon
Use DoubleToStr() function.

avatar
17
cleon 2006.01.20 14:19 
But when converting it to a string I can not use it in calculations, because it's a string?

Thank you.

avatar
90
Michal 2006.01.21 01:39 
cleon:
But when converting it to a string I can not use it in calculations, because it's a string?

Thank you.
But for calculations it does not matter if it is 112.80 or 112.8, does it? Or I'm missing something.
Back to topics list  

To add comments, please log in or register