Get the number of decimal places of any numbers (not just quotes) bypassing Digits() in MQL4 and MQL5 - page 4
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
Result: 500000000.0001:4
4, but not 8
You guessed it. And how many decimal places are there? 8?
I don't need to be tested.
I don't need to be checked.
Nevertheless, you have corrected your code - so the check was helpful
Nevertheless, you corrected your code
Look at where the code was pulled from. And for what practical purpose it was intended. If it is not clear - for prices.
There was no foolproofing in the code because it was not intended to be used by such a user.
In the course of the discussion, it turned out that foolproofing must be implemented if the code is published. Otherwise it will be 5 pages of shit.
So, indeed, corrected. Once again, numbers with infinite Digits is the norm.
I know how NormalizeDouble works, because I've played its full analogue.
It all depends a lot on what Digits you want to get. If double-representation, your code gives a different value. If digits of a numeric constant, it is correct (and not always).
It all depends a lot on what you need to get.
You need one
so that (in particular)
result is equal to: 4
You need one
to
The result was: 4
Perhaps that is exactly the function you need. Answered the TS.
Forum on trading, automated trading systems and strategy testing
How to get the decimal places of any numbers (not only quotes) bypassing Digits() in MQL4 and MQL5
Alexandr Sokolov, 2018.11.03 17:39
I think I'm not the only one who faced a rare situation when I needed to get the number of decimal places