No, NormalizeDouble seems to be working just as before with no change. It seems to be only a "display" problem. See my previous posts here on the thread, especially Post #17 .
Dark Ryd3r #: My orders are sent on like 0.45678 so how can i fix that, I see it works if value above 1 maybe
You should not be using "NormalizeDouble" to set the price nor the volume on orders placed. You should be adjusting the price to the "tick size" and the "lot step" for the volume for the symbol in question.
This has been discussed many times over on the forum, so if you do a search you should find many threads/topics about how to round or adjust them correctly.
Dark Ryd3r #: My EA Stopped sending orders due to this bug, so i explored and found this. Its an issue with NormalizeDouble which output can be seen
The bug is your EA, you are treating doubles as if they were precise but they are not, you are not using them correctly and the NormalizeDouble function should not even exist. Read the links I posted and start using floating points the right way.
Alexandre Borela #: The bug is your EA, you are treating doubles as if they were precise but they are not, you are not using them correctly and the NormalizeDouble function should not even exist. Read the links I posted and start using floating points the right way.
My EA does not work on tick price and it does not recognize Bid Ask, it recognizes close price and trigger orders on that. so i am using NormalizeDouble
double step_ = SymbolInfoDouble(_Symbol,SYMBOL_VOLUME_STEP);
int digitsx = DigitsCount(step_);
double dSize = NormalizeDouble(maxqty,digitsx);
int DigitsCount(double number)
{
int digits = 0;
while (NormalizeDouble(number, digits) != number) {
digits +=1;
}
return digits;
}
Dark Ryd3r #: My EA does not work on tick price and it does not recognize Bid Ask, it recognizes close price and trigger orders on that. so i am using NormalizeDouble
Have a look at the final section of the code below, namely the section "Adjust Volume for allowable conditions". The same logic can be applied to prices and the "tick size".
Have a look at the final section of the code below, namely the section " Adjust Volume for allowable conditions ". The same logic can be applied to prices and the "tick size".
My EA does not work on tick price and it does not recognize Bid Ask, it recognizes close price and trigger orders on that. so i am using NormalizeDouble
Fernando Carreiro #: You are using DoubleToString to the same number of digits, which cancels out any possible "bug" that NormalizeDouble may or may not have. Your test does not serve as a satisfactory evaluation of the situation.
Dark Ryd3r #: I confirm NormalizeDouble does not work and its an official bug and must be reported to ServiceDesk
Sorry, but your expectation of NormalizeDoulbe is wrong.
It changes a number only to the exponential value closest to the target value (x = a*e^b), but not to the target value if it cannot be represented by the mentioned formula.
To achieve this visually you have to use DoubleToString(), because this turns the internal representation a*e^b into a string of digits and a decimal point - but then you can't calculate with it any more.
I don't understand why people keep on discussing NormalizeDouble(). Unless I have misunderstood something, I don't see how it is related to this thread.
Allow the use of cookies to log in to the MQL5.com website.
Please enable the necessary setting in your browser, otherwise you will not be able to log in.
You are signed in. Two-factor authentication has been disabled. Set it up again and scan a new QR code, or continue with two-factor authentication disabled.
No, NormalizeDouble seems to be working just as before with no change. It seems to be only a "display" problem. See my previous posts here on the thread, especially Post #17 .
You should not be using "NormalizeDouble" to set the price nor the volume on orders placed. You should be adjusting the price to the "tick size" and the "lot step" for the volume for the symbol in question.
This has been discussed many times over on the forum, so if you do a search you should find many threads/topics about how to round or adjust them correctly.My EA Stopped sending orders due to this bug, so i explored and found this. Its an issue with NormalizeDouble which output can be seen
Read the links I posted and start using floating points the right way.
The bug is your EA, you are treating doubles as if they were precise but they are not, you are not using them correctly and the NormalizeDouble function should not even exist.
Read the links I posted and start using floating points the right way.
My EA does not work on tick price and it does not recognize Bid Ask, it recognizes close price and trigger orders on that. so i am using NormalizeDouble
Have a look at the final section of the code below, namely the section "Adjust Volume for allowable conditions". The same logic can be applied to prices and the "tick size".
Forum on trading, automated trading systems and testing trading strategies
How to calculate lots using multiplier according to number of opened orders?
Fernando Carreiro, 2017.09.01 21:57
Don't use NormalizeDouble(). Here is some guidance (code is untested, just serves as example):
Have a look at the final section of the code below, namely the section " Adjust Volume for allowable conditions ". The same logic can be applied to prices and the "tick size".
My EA does not work on tick price and it does not recognize Bid Ask, it recognizes close price and trigger orders on that. so i am using NormalizeDouble
https://floating-point-gui.de/errors/comparison/
https://docs.oracle.com/cd/E19957-01/806-3568/ncg_goldberg.html
You are using DoubleToString to the same number of digits, which cancels out any possible "bug" that NormalizeDouble may or may not have. Your test does not serve as a satisfactory evaluation of the situation.
Sorry. The former test code was wrong.
I just corrected it as:
The output is:
I confirm NormalizeDouble does not work and its an official bug and must be reported to ServiceDesk
Sorry, but your expectation of NormalizeDoulbe is wrong.
It changes a number only to the exponential value closest to the target value (x = a*e^b), but not to the target value if it cannot be represented by the mentioned formula.
To achieve this visually you have to use DoubleToString(), because this turns the internal representation a*e^b into a string of digits and a decimal point - but then you can't calculate with it any more.
Unless I have misunderstood something, I don't see how it is related to this thread.