
You are missing trading opportunities:
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
Registration
Log in
You agree to website policy and terms of use
If you do not have an account, please register
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.