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


金字塔客服中心 - 专业程序化交易软件提供商金字塔软件交易策略发布专区 → 阿火秘笈_编写技巧十九(12月5日更新_做参数优化时优化指定指标的方法)

   

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


  共有191939人关注过本帖树形打印复制链接

主题:阿火秘笈_编写技巧十九(12月5日更新_做参数优化时优化指定指标的方法)

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


加好友 发短信
等级:新手上路 帖子:99 积分:309 威望:0 精华:0 注册:2011/3/23 20:52:24
  发帖心情 Post By:2012/2/5 4:02:42 [显示全部帖子]

 

  请问如何把移动止损写入下面模型中

input:cang1(1,0,10,1),cang2(1,0,10,1);
variable:cc1=0,cc2=0;

hi:=ref(hhv(h,10),1);
lo:=ref(llv(l,10),1);
if cc1>0 and l<lo then begin
 pc:=min(max(holding,0),cang1);
 kc:=cang1-pc;
 if pc>0 then sell(1,pc,limitr,min(o,lo-0.2)-0.6);
 if kc>0 then buyshort(1,kc,limitr,min(o,lo-0.2)-0.6);
 cc1:=0;
end
if cc1<0 and h>hi then begin
 pc:=min(abs(min(holding,0)),cang1);
 kc:=cang1-pc;
 if pc>0 then sellshort(1,pc,limitr,max(o,hi+0.2)+0.6);
 if kc>0 then buy(1,kc,limitr,max(o,hi+0.2)+0.6);
 cc1:=0;
end
if cc1=0 and h>hi then begin
 pc:=min(abs(min(holding,0)),cang1);
 kc:=cang1-pc;
 if pc>0 then sellshort(1,pc,limitr,max(o,hi+0.2)+0.6);
 if kc>0 then buy(1,kc,limitr,max(o,hi+0.2)+0.6);
 cc1:=1;
end
if cc1=0 and l<lo then begin
 pc:=min(max(holding,0),cang1);
 kc:=cang1-pc;
 if pc>0 then sell(1,pc,limitr,min(o,lo-0.2)-0.6);
 if kc>0 then buyshort(1,kc,limitr,min(o,lo-0.2)-0.6);
 cc1:=-1;
end


 回到顶部