from vnpy.app.cta_strategy import(
CtaTemplate,
BarGenerator,#k线合成器
ArrayManager#k线时间容器
)
from vnpy.trader.object import (
BarData
)
class DemoStrategy(CtaTemplate):#DemoStratege 演示策略继承于 类 CtaTemplate
""""""
author = ""#策略作者
#定义参数
fast_window=10#快速均线
slow_window=20#慢速均线
#定义变量
fast_ma0=0.0 #当前最新均线的数值
fast_ma1=0.0 #上一条均线的数值
slow_ma0=0.0
slow_ma1=0.0
parameters = [ #参数名字字符串
"fast_window",
"slow_window"
]
variables = [ #变量列表
"fast_ma0","fast_ma1","slow_ma0","slow_ma1"
]
def __init__(
self,
cta_engine: Any,
strategy_name: str,
vt_symbol: str,
setting: dict,
):
print("ok")
^
IndentationError: expected an indented block
是 def init()这出现的问题 可是不知道哪里错了啊 整了一上午了 求指教