the code is about adaptive moving average,from the formular,the value of the parameter changes according to the ratio of current bar's volatility and last bar's volatility:
Code: Select all
lookBackDays = lookBackDays * (1 + deltaVolatility);
lookBackDays = Minlist (lookBackDays, CeilingAmount);
lookBackDays = Maxlist (lookBackDays, FloorAmount);
intlookBackDays = Intportion (lookBackDays);
as in test.xlsx data file in attachment,at 2014-4-21 14:30,the parameter "intLookBackDays" result from the code is 22,the same as which from excel,but at 14:40,there comes the differnce,the result from the code is 22,while the result from excel is 25,more differences are following after this point.
from the formular in the indicator,the value of deltaVolatility is higher than 0,so the value of intLookBackDays should be higher than its previous value,that's,the results from excel are correct.