以文本方式查看主题

-  金字塔客服中心 - 专业程序化交易软件提供商  (http://weistock.com/bbs/index.asp)
--  公式模型编写问题提交  (http://weistock.com/bbs/list.asp?boardid=4)
----  如何实现提前下单  (http://weistock.com/bbs/dispbbs.asp?boardid=4&id=76540)

--  作者:tanganquan
--  发布时间:2015/3/17 10:57:00
--  如何实现提前下单

八、提前N秒下单的方法,适用于各个周期 

//这里以股指期货为例,商品原理类似:关键是找出K线结束的时间规律。

ma5:=ma(c,5);
ma10:=ma(c,10);
zq:=2;//周期类型,2分钟就填2,3分钟就填3 ,5分钟就填5,10分钟就填10
tq:=5;//提前的秒数,最多提前60秒
lastopentm:=if(date<>ref(date,1),0,ref(openminutes(time),1));//上一根K线的开盘分钟数
ticktm:=dynainfo(207);
abb:=(mod(ticktm,100)>=60-tq and (openminutes(ticktm)-lastopentm=zq-1 or (ticktm>=112900 and ticktm<=113000) or (ticktm>=151400 and ticktm<=151500))) 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

 


 老师,你好,这是阿火老师的提前下单,我把abb  放在 我的开多条件里,还是 不能实现提前下单,我用的是股指3分钟,市价下单,我把参数设置成10秒,他不能提前下单,只能倒数10秒发信号。请指教一下,怎么实现提前下单。


--  作者:jinzhe
--  发布时间:2015/3/17 10:59:49
--  
用固定轮询模式下单,不要用走完k线下单
--  作者:tanganquan
--  发布时间:2015/3/17 11:02:02
--  
固定轮询模式下单?????、
要怎么设置下呢?谢谢!

--  作者:jinzhe
--  发布时间:2015/3/17 11:04:21
--  

图片点击可在新窗口打开查看此主题相关图片如下:1.png
图片点击可在新窗口打开查看

--  作者:tanganquan
--  发布时间:2015/3/17 11:04:56
--  
我用的是 图表程序化。
--  作者:jinzhe
--  发布时间:2015/3/17 11:05:16
--  
参考上面的设置