from PythonApi import *
import time
import os
import csv
import numpy
import talib as ta
# 参数定义区,这里定义的参数可以直接在context对象中获取。--(选择实现)
def parameter():
input_par("myvalues1",5,1,20,1)
input_par("myvalues2",10,1,20,1)
# 在这个方法中编写任何的初始化逻辑。context对象将会在你的算法策略的任何方法之间做传递。--(必须实现)
def init(context):
context.s1 =context.run_info.base_book_id
#获取K线数据
#HID_hight = history_bars(context.s1,10000,'1m','hight')#获取1分钟最高价
HID_hight = history_bars(context.s1,myvalues1,'self','hight',TRUE)
HID_low = history_bars(context.s1,10000,'1m','LOW')#获取1分钟最低价
HID_close = history_bars(context.s1,10000,'10000','close')#获取1分钟最低价
如果想直接引用画面的周期(就是画面换周期,指标也换周期)的那种,一个怎么写
哦,
def init(context):
context.s1 =context.run_info.base_book_id
#获取K线数据
HID_hight = history_bars(context.s1,10000,'1m','hight')#获取1分钟最高价
HID_hight = history_bars(context.s1,myvalues1,'self','hight',TRUE)
HID_low = history_bars(context.s1,10000,'1m','LOW')#获取1分钟最低价
HID_close = history_bars(context.s1,10000,'10000','close')#获取1分钟最低价
那么这部分获取数值的写法对的吗?
1,HID_hight = history_bars(context.s1,10000,'1m','hight')#获取1分钟最高价
2, HID_hight = history_bars(context.s1,myvalues1,'self','hight',TRUE)
这两种都对?两种有什么区别吗?万分感谢