William Roeder:
MT4:NormalizeDouble - General - MQL5 programming forum
How to Normalize - Expert Advisors and Automated Trading - MQL5 programming forum
MT4:NormalizeDouble - General - MQL5 programming forum
How to Normalize - Expert Advisors and Automated Trading - MQL5 programming forum
Thanks for the hint, but it does not help me much, I could brute force it but I am hoping for an elegant solution :)
I was bored stiff, so here goes:
double Add1ToLast(double Value) { int DecPts = 0; while (DecPts<10) { double Mult = MathPow(10,DecPts); int Reference = (int)(Value*Mult); if (Reference==Value*Mult) { if (Reference%10==0) // Safeguard against a weird scenario Mult = Mult/10; // e.g. Value of 1.11878 gets 1.118781 ?! @^#*$ return (Value+1/Mult); } DecPts++; } return (-1); }
Seng Joo Thio:
I was bored stiff, so here goes:
Thank you :)
samjesse:
What would it be helpful for?
Hi
I have been coding this for some time but can not get a working code, here is the input and the desired output.
input string | output double |
---|---|
1.2900 | 1.3 |
125.90 | 126 |
Thanks
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
Hi
I have been coding this for some time but can not get a working code, here is the input and the desired output.
Thanks