data type double, number places after the period

 

since IBFX is now with 5 decimal places, for some reason when i declare double, the values have 4 decimal places.


example

Ask price: 1.31475


double askk=Ask; Comment(askk);


//the comment only contains 4 decimal places, 1.3147


Is there a way to add more decimal places to a double datatype?

 
Comment(DoubleToStr(askk, Digits));
 
c0d3 wrote >>

since IBFX is now with 5 decimal places, for some reason when i declare double, the values have 4 decimal places.

example

Ask price: 1.31475

double askk=Ask; Comment(askk);

//the comment only contains 4 decimal places, 1.3147

Is there a way to add more decimal places to a double datatype?

Try:

double askk=Ask;

Comment(DoubleToStr(askk,5));

The issue is not the double cast, it is the comment function. Read this description of Comment() from the docs (it automatically truncates doubles to 4 digits):

---------------------------------------------------------------------------------------------------------------------------------------

void Comment( ...)
The function outputs the comment defined by the user in the left top corner of the chart. Parameters can be of any type. Amount of passed parameters cannot exceed 64.

Arrays cannot be passed to the Comment() function. Arrays should be output elementwise.

Data of double type output with 4 digits after the decimal point. To output with more precision, use the DoubleToStr() function.
Data of bool, datetime and color types will be output as their numeric presentation.
To output values of datetime type as strings, convert them with the TimeToStr() function.

Reason: