NormalizeDouble() not working

 
StopLossBuy    = NormalizeDouble(Low[2] - 0.0003, Digits()); 	//1.1304799999999999
StopLossBuy    = NormalizeDouble(Low[2] - 0.0003, 5); 		//1.1304799999999999

I have tried both code from both code after decimal value appearing 16 digits. Where I have made mistake?

 
kumaillakhani:

I have tried both code from both code after decimal value appearing 16 digits. Where I have made mistake?

This is not your fault, it's a feature of double type. NormalizeDouble() provides rounding (BTW in a slightly non standard way) to required number of decimal places. But double is still double.
It could be dangerous to normalize prices (stop loss and take profit are also prices) by NormalizeDouble() because not always a tick size is equal to points.
 
Petr Nosek:
This is not your fault, it's a feature of double type. NormalizeDouble() provides rounding (BTW in a slightly non standard way) to required number of decimal places. But double is still double.
It could be dangerous to normalize prices (stop loss and take profit are also prices) by NormalizeDouble() because not always a tick size is equal to points.
Could you please provide a reference to the rounding standard(s) ? Thanks.
 
May be you should read this here: http://articles.mql4.com/866
Working with Doubles in MQL4
Working with Doubles in MQL4
  • www.mql5.com
The MQL programming opens new opportunities for the automated trading, many people all over the world already have appreciated it. When we are writing an Expert Advisor for trading, we must be sure that it will work correctly. Many newbies often have some questions when the results of some mathematical calculations differ from those expected...
 
Alain Verleyen:
Could you please provide a reference to the rounding standard(s) ? Thanks.

https://physics.nist.gov/cuu/pdf/sp811.pdf

appendix B.7 on page 43

 
Petr Nosek:

https://physics.nist.gov/cuu/pdf/sp811.pdf

appendix B.7 on page 43

Thanks Petr.

However what I wanted to point is there is no reason to think Metaquotes is following any standard if not documented, certainly not a US standard.

 
Alain Verleyen:

Thanks Petr.

However what I wanted to point is there is no reason to think Metaquotes is following any standard if not documented, certainly not a US standard.

You're right that Metaquotes doesn't have to follow any standard (SI is not an US standard, but an international standard).
 
Petr Nosek:
You're right that Metaquotes doesn't have to follow any standard (SI is not an US standard, but an international standard).

NIST is US, it's what I meant.

US like to think they are the "international standard". But it's not the place to discuss about that.