发布时间:2019-09-21 10:44:57编辑:auto阅读(3784)
import numpy as np def KDJ(date,N=9,M1=3,M2=3): datelen=len(date) array=np.array(date) kdjarr=[] for i in range(datelen): if i-N<0: b=0 else: b=i-N+1 rsvarr=array[b:i+1,0:5] rsv=(float(rsvarr[-1,-1])-float(min(rsvarr[:,3])))/(float(max(rsvarr[:,2]))-float(min(rsvarr[:,3])))*100 if i==0: k=rsv d=rsv else: k=1/float(M1)*rsv+(float(M1)-1)/M1*float(kdjarr[-1][2]) d=1/float(M2)*k+(float(M2)-1)/M2*float(kdjarr[-1][3]) j=3*k-2*d kdjarr.append(list((rsvarr[-1,0],rsv,k,d,j))) return kdjarr
关键字:
上一篇: python读取pdf文档-实战
下一篇: python-crontab实现定时任务
51559
51132
41656
38411
32901
29875
28593
23553
23484
21830
1981°
2683°
2245°
2176°
2622°
2193°
2941°
4865°
4700°
3345°