Download MetaTrader 5
To add comments, please log in or register
Publish your programs in the Market. Make money with your knowledge!
scarte644
8
scarte644 2016.06.24 07:07 

Hey everyone,

I have a strange problem. An EA I coded tests fine on everything but CHF and JPY pairs where sometimes erratic prices form and won't normalise.

For instance, the ask price from yesterday for NZDJPY at 22:00:03.357 is 77.11499999999999. I then normalise that as part of the process with normalisedouble to 3 digits, and the result is... 77.11499999999999.

The same thing happened on USDCHF and some others, all JPY or CHF pairs though.

Pulling an odd ask figure is fine, but why won't the normalise function work on it to get it to a usable figure?

Many thanks for any insights.

Steve

Carl Schreiber
6347
Carl Schreiber 2016.06.24 08:26  
The reason is the nature of the doubles (Wiki..). Use DoubleToString() or PrintFormate() to get an "pleasant look".
Keith Watford
Moderator
9420
Keith Watford 2016.06.24 08:26  

The price IS normalized.

If you need to display or Print use DoubleToStr()

scarte644
8
scarte644 2016.06.24 11:34  
Ah lovely, thank you both :)
/
To add comments, please log in or register