3.41K 浏览
0

代码:

………
# 获取SYMBOL1合约的10秒K线
klines = api.get_kline_serial(SYMBOL1, 1)
………
# 技术指标 ——————————————————————————————————————–
HH = tafunc.hhv(klines.high, N) # 求N个周期最高价, 即N周期高点(包含当前k线)
#print(” ||| HH1 = “,HH[N],” H2 = “,HH[N+1],” H3 = “,HH[N+2],” H4 = “,HH[N+3],” H5 = “,HH[N+4],” H6 = “,HH[N+5])
print(” ||| HHV = “,list(HHV))

结果:

“2020/01/07-10:02:58″,” ||| HHV = [nan, nan, nan, nan, nan, nan, nan, nan, nan, 2349.0, 2349.0, 2349.0, 2349.0, 2349.0, 2349.0, 2349.0, 2349.0, 2349.0, 2349.0, 2349.0, 2349.0, 2349.0, 2351.0, 2351.0, 2351.0, 2351.0, 2351.0, 2351.0, 2351.0, 2351.0, 2351.0, 2351.0, 2351.0, 2351.0, 2351.0, 2351.0, 2351.0, 2351.0, 2351.0, 2351.0, 2351.0, 2351.0, 2351.0, 2351.0, 2351.0, 2351.0, 2351.0, 2351.0, 2351.0, 2351.0, 2351.0, 2351.0, 2351.0, 2351.0, 2351.0, 2351.0, 2351.0, 2351.0, 2351.0, 2351.0, 2351.0, 2351.0, 2351.0, 2351.0, 2351.0, 2351.0, 2351.0, 2351.0, 2351.0, 2351.0, 2351.0, 2351.0, 2351.0, 2351.0, 2351.0, 2351.0, 2351.0, 2351.0, 2351.0, 2352.0, 2352.0, 2352.0, 2352.0, 2352.0, 2352.0, 2352.0, 2352.0, 2352.0, 2352.0, 2352.0, 2352.0, 2352.0, 2352.0, 2352.0, 2352.0, 2352.0, 2352.0, 2352.0, 2352.0, 2352.0, 2352.0, 2352.0, 2352.0, 2352.0, 2352.0, 2352.0, 2352.0, 2352.0, 2352.0, 2352.0, 2352.0, 2352.0, 2352.0, 2352.0, 2352.0, 2352.0, 2352.0, 2352.0, 2352.0, 2352.0, 2352.0, 2352.0, 2352.0, 2352.0, 2352.0, 2352.0, 2352.0, 2352.0, 2352.0, 235″

请问:hhv()结果哪个是当前的最高价,或者说如何取得1分钟K线图10周期的最高价?

west 已回答的问题 2020年1月9日
0

你代码里,传入的是klines.high ,即K线的最高价序列,那hhv函数就是用的这个序列来计算其中的最高价。文档中有指标函数的使用方法,想详细了解的话也可以去github上看这个函数的实现源码

west 已回答的问题 2020年1月9日
您正在查看1个答案中的1个,单击此处查看所有答案。