当前位置:首页 > 金字塔公式 > 内容

移动止损模版[其他期货软件]

作者:公式指标网   更新时间:2015-10-25   点击:

使用说明:

该模版用于历史评测,不用于实盘交易。


 该模版的亮点在于模块化和扩展性

理解模版精华后,各种思路可在模版里随便添加、删除、扩展等

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

//理解模版精华后,各种思路可在模版里随便添加、删除、扩展等
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

 

资源下载

相关文章

热门推荐

移动端首页 | PC端

© by gszx.com.cn Mobile Web