欢迎使用金字塔普通技术服务论坛,您可以在相关区域发表技术支持贴。
我司技术服务人员将优先处理 VIP客服论坛 服务贴,普通区问题处理速度慢,请耐心等待。谢谢您对我们的支持与理解。


金字塔客服中心 - 专业程序化交易软件提供商金字塔软件公式模型编写问题提交 → [原创]提前N秒下单的方法,适用于各个周期

   

欢迎使用金字塔普通技术服务论坛,您可以在相关区域发表技术支持贴。
我司技术服务人员将优先处理 VIP客服论坛 服务贴,普通区问题处理速度慢,请耐心等待。谢谢您对我们的支持与理解。    


  共有29139人关注过本帖平板打印复制链接

主题:[原创]提前N秒下单的方法,适用于各个周期

帅哥哟,离线,有人找我吗?
阿火
  1楼 | QQ | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信 原leevolvo
等级:版主 帖子:2160 积分:10563 威望:0 精华:11 注册:2010/11/3 11:21:19
[原创]提前N秒下单的方法,适用于各个周期  发帖心情 Post By:2011/11/17 10:55:20    Post IP:120.42.45.130[只看该作者]

老是有人希望提前N秒下单

在此提供一种自己编写的方法

适用于各个周期,注意:选用固定时间间隔模式

2011-12-26 做了更新,给出了不规律周期的K线结束时间

 

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

ma5:=ma(c,5);
ma10:=ma(c,10);
zq:=2;//周期类型,2分钟就填2,3分钟就填3 ,5分钟就填5
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

 

大家注意了

2.80版本以上,time这个函数有所变化,直接可以直接获得K线结束的时间。提前下单更加方便了

ma5:=ma(c,5);
ma10:=ma(c,10);
input:tq(5,3,60,1);
abb:=(time0-timetot0(dynainfo(207))<=tq) 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

[此贴子已经被作者于2012-2-9 10:20:04编辑过]

[本帖被加为精华]
 回到顶部
总数 45 1 2 3 4 5 下一页