Round off Price value

Back to topics list To post a new topic, please log in or register
avatar
54
d.saravana21 2015.10.12 13:49
 

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


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

avatar
54
d.saravana21 2015.10.12 14:24 #
 
WHRoeder:

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


with Regards

Saravana

avatar
54
d.saravana21 2015.10.17 11:55 #
 

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
Back to topics list  

To add comments, please log in or register