以文本方式查看主题

-  金字塔客服中心 - 专业程序化交易软件提供商  (http://www.weistock.com/bbs/index.asp)
--  金字塔软件问题提交  (http://www.weistock.com/bbs/list.asp?boardid=2)
----  k线结束前执行  (http://www.weistock.com/bbs/dispbbs.asp?boardid=2&id=99733)

--  作者:ying_223223
--  发布时间:2016/6/28 15:16:42
--  k线结束前执行
看了阿火的帖子,

abb:=(time0-timetot0(dynainfo(207))<=5) or not(islastbar);

if abb then begin
  if holding>0 and ma5<ma10 then sell(1,1,thisclose);
  if holding<0 and ma5>ma10 then sellshort(1,1,thisclose);
  if holding=0 and ma5>ma10 then buy(1,1,thisclose);
  if holding=0 and ma5<ma10 then buyshort(1,1,thisclose);

end
这个条件觉得不太对,

这段代码开平仓执行的时机是:如果当前k线是当天最后一根k线并且在收盘前5秒,或者当前k线不是最后一根k线,下面的开平仓就会被固定时间去执行

--  作者:ying_223223
--  发布时间:2016/6/28 15:18:48
--  
如果想要实现,在每根k线都提前5秒执行不应该用上述条件吧
--  作者:pyd
--  发布时间:2016/6/28 15:28:47
--  
是这个abb的条件和开平仓条件满足就会提前5秒下单
--  作者:ying_223223
--  发布时间:2016/6/28 15:34:28
--  
abb:=(time0-timetot0(dynainfo(207))<=5) or not(islastbar);

只要islastbar=0, abb就会等于1,而islastbar=0不就是说当前的k线不是最后一根k线吗

也就是说只要当前不是最后一根k线开平仓的判断与执行就会在每次固定间隔时间去执行,而不是k线的最后5秒。
我上面的理解有什么问题吗

--  作者:pyd
--  发布时间:2016/6/29 14:08:00
--  

不是的

not(islastbar)是保留历史信号用的,

(time0-timetot0(dynainfo(207))<=5)是判断当前k离走完k线是否<=5秒