The OUTPUT of normalizedouble function is rounded to the specified digits...NOTHING is done to the inputs themselves.
try:
double var=1.12345678; Alert("var= ",var); // <- corrected left-bracket typo double normalizedvar = NormalizeDouble(var,1); Alert("normalizedvar= ",normalizedvar);
This is why my function wasnt working properly, it uses a fib sequence and I discovered the golden ratio number 1.618 isnt really true, it is almost true but not quite, it is a few hundredths out so to create a fib sequence from it I needed to normalise each time to 0 places. it works now like this, so now the whole function has the correct values to work on. Thanks again Phillip.
for(fib=1; fib<1000; fib=NormalizeDouble(fib*1.618,0)) //fib sequence
You are missing trading opportunities:
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
Registration
Log in
You agree to website policy and terms of use
If you do not have an account, please register
Ive been having a problem in my code I think i have it narrowed down to my use of NormalizeDouble, i tested NormalizeDouble to see what its output is with this simple code:
double var=1.12345678;
Alert)"var= ",var);
NormalizeDouble(var,1);
Alert("normalizedvar= ",var,1);
output is
var= 1.1235
normalizedvar=1.1235
i didnt expect var to be automatically rounded down to 4 decimal places before normalizing but it is,
I expected after NormaliseDouble the variable would be rounded down to 1 decimal place but it isnt, it is still 1.1235
why is this ? is normalizedouble not what i thought it was ?