Get the number of decimal places of any numbers (not just quotes) bypassing Digits() in MQL4 and MQL5 - page 9

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
That's not what I was talking about at all. The idea of converting a duble to a string so that you can then count the characters in the string is a complete nonsense. No matter what you do.
What's the big deal? So far, this option is the fastest, most functional and guaranteed correct. What are your options?
Yes, my variant is probably not the best, but since I've never found anything about it before, it's the best I came up with on my own, I commented above, while you didn't suggest your own variant.
I compared these variants:
The string variant is slightly faster, and it's not limited to 8 digits like d(). And the guarantee of correctness is counting by the way the terminal displays the number.
I choose the variant with conversion to string.
What's the big deal? So far, this option is the fastest, most functional, guaranteed to be the right one. What are your options?
Can you name at least one case of applying the above algorithm?
Can you name at least one case of applying the above algorithm?
There was one case for the trading panel to output the lot size with the correct number of decimal places in the text field. This is the only case.
There was one case for the trading panel to output the lot size with the correct number of decimal places in the text box. This is the only case.
I.e. it outputs "1" in case of 1 lot and "0.01" in case of 0.01 lot?
So it outputs "1" in the case of 1 lot and "0.01" in the case of 0.01 lots?
Not exactly. It depends on the minimum lot and the lot step. If the minimum lot is 0.01, then 1 is displayed as 1.00
Not really. Depending on the minimum lot and the lot increment. If the minimum lot is 0.01, then 1 is displayed as 1.00
O.o.
So it turns out you're not using your function, but still displaying something like DoubleToString(LotSize, <some const value>), no?
O.o
So it turns out that you don't use your function, but still output something like DoubleToString(LotSize, <some const value>), no?
Yes. But you have to know how many decimal places to output.
Yes. But you have to know how many decimal places to output.
In other words, do you use the min.lot (or lot increment) entered by the user to determine how many decimal places this value has, and then save it to normalise future values?
So you determine from the min.lot (or lot increment) entered by the user how many digits after the decimal point there are, and then save it to normalise future values?
What don't you understand? Price has Digits(), while volume doesn't. This is how it is calculated.
Why do you need volume digits? The same reason we need the price digits!