Use NormalizeDouble(). See below quotation from MQL5 reference.
NormalizeDouble
Rounding floating point number to a specified accuracy.
double NormalizeDouble( double value, // normalized number int digits // number of digits after decimal point );
Parameters
value
[in] Value with a floating point.
digits
[in] Accuracy format, number of digits after point (0-8).
Return Value
Value of double type with preset accuracy.
Note
Calculated values of StopLoss, TakeProfit, and values of open prices for pending orders must be normalized with the accuracy, the value of which can be obtained by Digits().
Example:
double pi=M_PI; |

- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
Hello dear developers,
I would like to store in a value the Buying price of a trade but with only two digits after decimal point.
How can I do this??
Thank you.
Antoine.