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


金字塔客服中心 - 专业程序化交易软件提供商金字塔软件交易策略发布专区 → [原创]闲来无聊,发布一个本人常用的模版: 移动止损模版_leevolvo版

   

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


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

主题:[原创]闲来无聊,发布一个本人常用的模版: 移动止损模版_leevolvo版

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


加好友 发短信 原leevolvo
等级:版主 帖子:2160 积分:10563 威望:0 精华:11 注册:2010/11/3 11:21:19
[原创]闲来无聊,发布一个本人常用的模版: 移动止损模版_leevolvo版  发帖心情 Post By:2011/6/20 12:57:42 [只看该作者]

//该模版用于历史评测,不用于实盘交易。
//该模版的亮点在于模块化和扩展性

//理解模版精华后,各种思路可在模版里随便添加、删除、扩展等
variable:zs=c,hl=c;//声明全局变量zs、hl
ma5:=ma(c,5);
ma20:=ma(c,20);
atr:=ma(h-l,20);//市场平均波动幅度
buycond:=cross(ma5,ma20);//平空开多条件
sellcond:=cross(ma20,ma5);//平多开空条件

if holding>0 then begin
 多止损:zs;
 if l<zs then sell(1,1,limitr,min(o,zs)-mindiff);
 else if sellcond then sell(1,1,limitr,c);
end

if holding<0 then begin
 空止损:zs;
 if h>zs then sellshort(1,1,limitr,max(o,zs)+mindiff);
 else if buycond then sellshort(1,1,limitr,c);
end

if holding=0 and buycond then begin//多头开仓
 buy(1,1,limitr,c);
 zs:=c-2*atr;
 hl:=c;//hl开仓后的最有利价位,刚买入时,最有利价位为开仓价
end

if holding=0 and sellcond then begin//空头开仓
 buyshort(1,1,limitr,c);
 zs:=c+2*atr;
 hl:=c;
end

if holding>0 and enterbars>0 and h>hl then begin//最高价抬升,止损位相应地抬升
 hl:=h;
 zs:=hl-2*atr;
end

if holding<0 and enterbars>0 and l<hl then begin//最低价下降,止损位相应地下移
 hl:=l;
 zs:=l+2*atr;
end

[此贴子已经被作者于2011-6-20 12:58:45编辑过]

 回到顶部
总数 11 1 2 下一页