Actually there is no bug in MathRound, you misunderstood.
printf("%.15f %.15f %.15f",price,price/tickSize,MathRound(price/tickSize));
2018.04.05 00:47:16.628 Test EURUSD,H1: 1.700605000000000 170060.499999999970896 170060.000000000000000
Actually it's not a bug at all in my opinion.
Yes, I do
Thank you for all. After read all 3 pages i changed my code to this way. Please tell me is this correct or not. Thank you.
double TP_Level = NormalizeDouble(Bid-(pips*Take_Profit),Digits);
double SL_Level = NormalizeDouble(Bid+(pips*Stop_Loss),Digits);
Earlier in this OrderSend(), I used order open price as "Bid". But when i send it for review, the product is failed by "Error 130". After that i used "ND(Bid)". I only added that ND and it is Ok! So is their any relation?
double ND(double val)
So finally what you recommend for me?
double NormalizePrice(const double price,string symbol=NULL)
if(symbol==NULL || symbol=="") symbol=_Symbol;
Then NormalizeDouble(170060.499999999970896,0) is wrong and MathRound is correct.
I would say no if we refer to the documentation. For MathRound() it's clearly specified "rounded off to the nearest integer". While NormalizeDouble() documentation is just saying "Rounding floating point number to a specified accuracy", without specifying what rounding.
But that's interesting, maybe you will finish to convince me about NormalizeDouble
Seriously, if a function is working as documented and it's behaviour is coherent, there is no problem to use it. Up to now I never read an example showing an unpredictable or incoherent value returned by NormalizeDouble.