赞
踩
I am trying to create a function for the Kaufman Adaptive Moving Average (KAMA), in Python Pandas or using Cython (I have already done this in R & Rcpp). Am having problems with the recursive calculation, filt1
filt1[i] = ( filt1[i-1] + SC[i]*(price[i]-filt1[i-1]) )
I am expecting the KAMA Series should have
(i) NA's to begin with, length of n=10
(ii) To start KAMA, for 2010-01-19 the raw mean of the price 1142.393, in this case the mean of the close's
(iii) Thereafter KAMA values from the recursive formulae filt1[i]
So:
KAMA
2010-01-04 NA
2010-01-05 NA
2010-01-06 NA
2010-01-07 NA
2010-01-08 NA
2010-01-11 NA
2010-01-12 NA
2010-01-13 NA
2010-01-14 NA
2010-01-15 NA
2010-01-19 1142.393
2010-01-20 1142.367
201
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。