Round off Price value

 

Dear Friends. and Traders.

int idigits = MarketInfo(Symbol(),MODE_DIGITS);

string close_val = DoubleToStr(iClose(cysymbol,cur_tf,i),idigits-1);

when i use this code it automatically round up the value. for example if the vale is 1.45678 the result is being as 1.4568... but i want 1.4567

any one kindly guide me.

sorry for my bad english


with Thanks and Regards

Saravana

 
string close_val = DoubleToStr(iClose(cysymbol,cur_tf,i),idigits);  // 1.45678
close_val = StringSubstring(close_val, 0, StringLen(lose_val) - 1); // 1.4567
 
WHRoeder:

Thank you so much for the assist bro.. Have a great day.


with Regards

Saravana

 

Bro i would like to add some "xxx" in that last value after i got StringLen modified.

 for example. in your code

string close_val = DoubleToStr(iClose(cysymbol,cur_tf,i),idigits);  // 1.45678
close_val = StringSubstring(close_val, 0, StringLen(lose_val) - 1); // 1.4567

it gives result 1.4567 and i want add 3 some more values after that like 1.4567xxx

the xxx value is constant string...

could you please guide me in this?

With Thanks and Regards

Saravana
Reason: