# Double type variable in Indicator

1313

Hi, We have an indicator where it finds the highest High within given 4 candles. And then it stores this value in a variable of type Double.

Sometime it change the value in double variable. For example highest high is 1.12347 in M15 EURUSD based on given four candles. And it is stored in a double variable.

double r = highest high

when we print the value, it shows 1.1234700000000002

and for some numbers it shows 1 as the 16th digit.

Could anyone help that which type of numbers, it is storing 16th digit. We need to identify those numbers to apply some logic.

4163

I don't understand exactly what is your doubt about... Do you need to "extract" the 16th digits from the number to apply some rules to it?

PS. I suggest to always normalize values about indicators and prices at the symbol digits. (_Digits)

1313

Fabio Cavalloni:

I don't understand exactly what is your doubt about... Do you need to "extract" the 16th digits from the number to apply some rules to it?

PS. I suggest to always normalize values about indicators and prices at the symbol digits. (_Digits)

Thanks for your reply. I need to know that why it adds 16th digit in some values and not in others. because when we run this indicator in a 3rd party simulator then it adds 16th digit in some candles and our logic skips these candles during comparison and this gives results in our favour.

When we run indicator in live charts then it doesn't add 16th digit at the same bars where it adds in simulation as history data.

Purpose is to have the indicator behaves in live as it in simulator to get the similar results.

yes we use normalized.

4163

I think that the value on that digits is pretty random and only a consequence of intrinsic normalization made by mt4 but I leave the word to someone who are sure about this, mine is just a theory.