klinedata5 = GetHisDataByField2( code,[ "high", "low" ], bar_type = BarType.Min5, count = 101 )
klinedata15= GetHisDataByField2( code,[ "high", "low" ], bar_type = BarType.Min15, count = 101 )
#取最近50根K线
rangehigh = max( klinedata15[0][:-1] ) #取区间高点
rangelow = min( klinedata15[1][:-1] ) #取区间低点
print("区间高点"+str(rangehigh))
print("区间低点"+str(rangelow))
#打印K线数据,如最新一根K线的最高价
if len(klinedata15) > 0 and len(klinedata5)> 0:
lasthigh15 = klinedata15.rangehigh,klinedata15.rangelow
lasthigh5 = klinedata5.rangehigh,klinedata5.rangelow
log.info("最新15分钟K线的最高价: " + str(lasthigh15))
log.info("最新5分钟K线的最高价: " + str(lasthigh5))
点
这是多周期的,怎样写才正确?回测才正常?
下面面这两句代码出错了,怎样才能引用到K线5分钟图,和15分钟图
#取最近50根K线
rangehigh = max( klinedata15[0][:-1] ) #取区间高点
rangelow = min( klinedata15[1][:-1] ) #取区间低