def get_records(value): Log(“get records day:”,value) records = exchange.GetRecords(PERIOD_D1) res = 0 for i in range(-(value + 1),-1): res = res + records[i][“Close”] Log(“time:”, records[i][“Time”], “value:”,records[i][“Close”]) return res/value
通过此函数计算均线 回测中,实盘的k线周期无法设置成天,所以records的长度往往只有5,6天,无法获取30日均线,改怎么解决?