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


金字塔客服中心 - 专业程序化交易软件提供商金字塔软件公式模型编写问题提交 → 图表程式化交易

   

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


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

主题:图表程式化交易

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


加好友 发短信
等级:管理员 帖子:5082 积分:17642 威望:0 精华:6 注册:2010/7/15 9:05:58
  发帖心情 Post By:2016/4/27 16:28:44    Post IP:180.169.30.6[只看该作者]

用以下两种方式都可以实现,模式选固定时间间隔,注意选用金字塔时区

原来的还想走完一根K线下单的,就直接用REF(下单条件,1)满足条件下单

想提前N秒下单的,比照以下方式改写即可

 

八、提前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 and ma5<ma10 then begin
  if holding>0 then sell(1,1,market);

  if holding=0 then buy(1,1,market);

end

 

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

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 and ma5<ma10 then begin
  if holding>0 then sell(1,1,market);

  if holding=0 then buy(1,1,market);

end

 

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

end



金字塔—专业程序化交易量化投资平台

客户服务部

-----------------------------------------------------------

欢迎您参加我公司的技术培训,具体培训需求请发邮件到

service@weistock.com

您的宝贵建议或者投诉,请发往邮箱:weiwei@weistock.com

 回到顶部
总数 55 1 2 3 4 5 6 下一页