Download MetaTrader 5
To add comments, please log in or register
Sign up for MQL5.community to leave your comments!
miko.szy
35
miko.szy 2014.02.08 21:47 

Hi,


I would like to compare Open[0] and Open[1].

My broker uses 5 decimal. So, I would like to compare them as 5 decimal number.

In Data window, I can see Open price with 5 decimals.

However, when I do Print() it, it appears only with 4 decimals.

ex) On data window, Open[0] = 0.89594 However, it appears as 0.8959 on log file.

I tried followings.

Print("Open[0] = ", Open[0]);

double open0 = Open[0]

Print("Open[0] = ", NormalizeDouble(open0, 5)) ;

open0 = NormalizeDouble(open0, 5);

Print("Open[0] = ", open0 ) ;

If anybody has any idea, your comment is much appreciated!

whroeder1
13627
whroeder1 2014.02.08 22:07  
miko.szy: However, when I do Print() it, it appears only with 4 decimals.
Print("Open[0] = ", NormalizeDouble(open0, 5)) ;
  1. RTFM
    Data of double type are printed with 4 decimal digits after point. To output more precisely, use the DoubleToStr() function.
  2. NormalizeDouble returns a double, INFINITE digits. Makes no difference to Print. Use PriceToStr()
  3. NormalizeDouble is a kludge, don't use it. It's use is always wrong.
miko.szy
35
miko.szy 2014.02.09 02:08  

Gosh... it was Print() related issue...

WHRoeder, thanks again. Much much appreciated!

/
To add comments, please log in or register