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


金字塔客服中心 - 专业程序化交易软件提供商金字塔软件公式模型编写问题提交 → 请合并两个策略

   

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


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

主题:请合并两个策略

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


加好友 发短信
等级:黑侠 帖子:993 积分:1787 威望:0 精华:5 注册:2012/11/28 17:37:20
  发帖心情 Post By:2013/5/4 21:33:13    Post IP:183.235.249.123[只看该作者]

哦,我明白你的意思了,我忽略了你用了这个条件,这种情况下无法用enterbars,因为他只表示最近信号的了,你还可以用我的办法,只是要继续用超全局变量了:

globalvariant:hold1=0,hold2=0,enterbars1=-1,enterbars2=-1,enterprice1=0,enterprice2=0;

//策略1.

enterbars1:=enterbars1+1;

if holding>0 and hold1>0 and enterbars1>=1 and c>=enterprice1 then

begin

  hold1:=hold1-1;

  enterbars1:=0;

  enterprice1:=c;

  sell(1,100%,thisclose);//买入后赚钱就卖。

end;

if holding>0 and hold1>0 and enterbars=3 then

begin

  hold1:=hold1-1;

  sell(1,100%,thisclose);//3个bar不管输赢都卖掉。

end; 

if ref(c,1)>ref(c,2) then

begin

  hold1:=hold1+1;

  buy(1,1,limitr,o);//当昨日收阳买入。

end;

 

策略2你用相同的原理改写,应该不用我写给你了


 回到顶部