Rounding numbers in MT4 via NormalizeDouble - page 5 123456789101112...17 New comment [Deleted] 2016.02.25 11:04 #41 Dmitry Fedoseev:Here is your code: Put 3 instead of 2 and it's 0.036It worked! Thank you. I normalise to 3 and then trim the extra digits after the decimal point.Can you tell me, is there a standard function to trim H digits after the comma? Like StringSubStr only if it is a fractional number. Is it possible to Any rookie question, so Only "Useful features from Ihor Herasko 2016.02.25 11:22 #42 Roman Starinskij:That's how it works! Thank you. I normalise to 3 digits and then trim the extra digits after the decimal point.Can you tell me if there is a standard function to trim H digits after the decimal point? Like StringSubStr only if it is a fractional number. If you want to trim digits when displaying them on the screen (log), there is DoubleToString() for that. Dmitry Fedoseev 2016.02.25 11:36 #43 Ihor Herasko: If you're talking about trimming digits when outputting to the screen (log), then DoubleToString() is for that.No. DoubleToString works just like NormalizeDouble(). Dmitry Fedoseev 2016.02.25 11:37 #44 Roman Starinskij: That's how it works! Thank you. I normalise to 3 digits and then trim the extra digits after the decimal point.Can you tell me if there is a standard function to trim H digits after the decimal point? Like StringSubStr only if it is a fractional number. There is no such function, as it is not needed. Your calculator is wrong. Lilita Bogachkova 2016.02.25 11:50 #45 Roman Starinskij:Can you tell me if there is a standard function to truncate H digits after the decimal point? Like StringSubStr only if it is a fractional number.I use one, but it's 'non-standard'://+------------------------------------------------------------------+ //| Double Crop function | //+------------------------------------------------------------------+ double DoubleCrop(double value,int crop) { string ValueToString=""; ValueToString=DoubleToString(value,crop); return StringToDouble(ValueToString); } //+------------------------------------------------------------------+ [Deleted] 2016.02.25 11:57 #46 lilita bogachkova: I use one, but it's 'custom':What's the genius move?string ValueToString=""; ValueToString=DoubleToString(value,crop); Dmitry Fedoseev 2016.02.25 12:15 #47 lilita bogachkova: I use one, but it's 'out of the box': Just wrote, DoubleToString doesn't trim, it works the same way as NormalizeDouble - it rounds. No... we're on a bulldozer. Dmitry Fedoseev 2016.02.25 12:17 #48 A glitch is detected: Alert( DoubleToStr(1.15,1)+" "+ DoubleToStr(1.25,1)+" "+ DoubleToStr(1.35,1)+" "+ DoubleToStr(1.45,1) );Result: 1.1 1.3 1.4 1.5With 1.15 there was a discard and with steel numbers there was a rounding. Lilita Bogachkova 2016.02.25 12:24 #49 Dmitry Fedoseev: A glitch is detected:Result: 1.1 1.3 1.4 1.5With 1.15 there was a discard and with steel numbers there was a rounding. Yes, I must admit using it without checking the result :((( [Deleted] 2016.02.25 13:35 #50 Until the developers removeit StringLenThe number of characters in the string, not including the trailing zero.there is nothing you can do about the truncation. 123456789101112...17 New comment
Here is your code:
Put 3 instead of 2 and it's 0.036
It worked! Thank you. I normalise to 3 and then trim the extra digits after the decimal point.
Can you tell me, is there a standard function to trim H digits after the comma? Like StringSubStr only if it is a fractional number.
That's how it works! Thank you. I normalise to 3 digits and then trim the extra digits after the decimal point.
Can you tell me if there is a standard function to trim H digits after the decimal point? Like StringSubStr only if it is a fractional number.
If you're talking about trimming digits when outputting to the screen (log), then DoubleToString() is for that.
No. DoubleToString works just like NormalizeDouble().
That's how it works! Thank you. I normalise to 3 digits and then trim the extra digits after the decimal point.
Can you tell me if there is a standard function to trim H digits after the decimal point? Like StringSubStr only if it is a fractional number.
Can you tell me if there is a standard function to truncate H digits after the decimal point? Like StringSubStr only if it is a fractional number.
I use one, but it's 'non-standard':
I use one, but it's 'custom':
What's the genius move?
I use one, but it's 'out of the box':
A glitch is detected:
Result: 1.1 1.3 1.4 1.5
With 1.15 there was a discard and with steel numbers there was a rounding.
A glitch is detected:
Result: 1.1 1.3 1.4 1.5
With 1.15 there was a discard and with steel numbers there was a rounding.
Until the developers remove
it
StringLen
The number of characters in the string, not including the trailing zero.
there is nothing you can do about the truncation.