Exponential notation

 

Hello,

I am trying to find the difference between two moving averages but when I print it gives the answer in exponential notation which is completely useless to me. The answer (on GBPUSD) could be 0.00001 or 0.00005 etc. That is the information I need. I have tried using NormalizeDouble() and not using it but both produce the same result whether I use Digits or just specify the number of digits as 5. Surely somebody must have done this before!

Thanks,

Phil

 

Divide the difference by _Point and print it out with DoubleToString():

double vSMA = ...,
       vEMA = ...;
Comment(DoubleToString((vEMA-vSMA)/_Point,2));

(Not tested just typed!)

 
Carl Schreiber #:

Divide the difference by _Point and print it out with DoubleToString():

(Not tested just typed!)

Thank you Carl - works a treat!!

 
Sneck55: when I print it gives the answer in exponential notation which is completely useless to me.

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)

Reason: