在OnTimer里指定时间重启策略单元不成功
OnTimer(Integer id,Integer intervalMillsecs) { if(id == timerID) { if (time>=0.2035 && time<=0.2036) ReStart(); } } 请问,以上代码为什么无法在指定时间内重新运行策略单元?
OnTimer(Integer id,Integer intervalMillsecs) { if(id == timerID) { if (time>=0.2035 && time<=0.2036) ReStart(); } } 请问,以上代码为什么无法在指定时间内重新运行策略单元?
Time获取的bar的时间,检查一下什么周期,是否落在你设置的时间区间?
回复:明白了,是这个原因,谢谢
有加载合约吗?什么合约?
回复:就加载一个ag888
贴完整图方向吧,这样猜不方便
回复:Params //此处添加参数 Numeric millsecs(1000); Vars //此处添加变量 Numeric avg; Global Integer timerId; Defs Events //初始化事件函数,策略运行期间,首先运行且只有一次,应用在订阅数据等操作 OnInit() { timerId=createTimer(millsecs); } //Bar更新事件函数,参数indexs表示变化的数据源图层ID数组 OnBar(ArrayRef<Integer> indexs) { } //定时器更新事件函数,参数id表示定时器的编号,millsecs表示定时间的间隔毫秒值 OnTimer(Integer id,Integer intervalMillsecs) { if(id == timerID) { if (time>=0.2034 && time<=0.2036) ReStart(); } }
有没有createtimer?
回复:当然有啊