- Custom Indicator Display
- function Mathlog
- HedgeEA
double NormalizeDouble( double value, int digits)
https://docs.mql4.com/convert/NormalizeDouble
NormalizeDouble(1.4513, 2) yields 1.45
Actually, its still not working as I thought it would. I want to print the value produced out onto the chart so the code I have is this:
string blueval = NormalizeDouble(blue[0],4);
ObjectCreate("BlueVal", OBJ_LABEL, 0, 0, 0);
ObjectSet("BlueVal", OBJPROP_CORNER, 0);
ObjectSet("BlueVal", OBJPROP_XDISTANCE, 10);
ObjectSet("BlueVal", OBJPROP_YDISTANCE, 15);
ObjectSetText("BlueVal", blueval, 10, "Arial", Blue);
where blue[0] is the original double figure of 1.37895645 (or similar). The current output on the chart is 1.37890000 os similar. I'd like it to be 1.3789 - without the trailing figures!
Thanks again in advance...
Since you are converting it into a string try:
https://docs.mql4.com/convert/DoubleToStr
string DoubleToStr( | double value, int digits) |
value | - | Floating point value. |
digits | - | Precision format, number of digits after decimal point (0-8). |
string value=DoubleToStr(1.28473418, 5);
// the value is "1.28473"

- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use