Round Variables Simply
-
Hello, I am using the following Custom MQL code to remove the many decimal places that a variable sometimes display in a comment.
RoundTrade4=MathRound(Trade4);
However, this produces an integer when I want two decimal places. Is there a simple change to this code to make it display 2 decimal places? (that would be nice)
I have tried other code without success. Thanks
-
@raveon Use the same function, but before it multiply by 100, and afterwards divide by 100
-
@roar Could you explain to me how to do that please, I have been looking for how to leave only two digits after the period for months.
-
@leka-0 you mean for some text bit, like comment message?
In that case, use
DoubleToStr(yournumber, 2)
-
@roar perfect now it works.
I have one more doubt, it can be done with fxdreema to link two objects, for example a horizontal line and a text, if the line moves that the text also moves with it, I want the line to show me a description without the need to put the mouse over it, I mean that the description of the line is visible in the graph. -
@leka-0 Not sure that is possible AFAIK. I guess you would need custom code to do that.