I have this string str = "1.52220";
And i want to send an Order with this price. I need to convert it in Double.
So when i convert it to double using StrToDouble
, it removes last 0 and return this 1.5222 and OrderSend
function is not accepting this value, it is return 130 error because amount of digits after decimal points are not normalized.
So then i try: NormalizeDouble(StrToDouble(str), digits)
but also not working, not added last zero.
I am calculating digits for symbol with this function:
int digits = (int)MarketInfo(symbol, MODE_DIGITS);
and for this example is 5.
double price = NormalizeDouble(StrToDouble(str), digits);
Then value of price is 1.5222 and not 1.52220.
Is there some way to don't remove last zero? or the problem is somewhere else?
Or i have to check if last character in string str is zero and than replace it with 1, then would be value fine. Thank you.