您现在的位置:好股网 >> 股票公式 >> 金字塔公式 >> 一键转帖:移动止损模版

移动止损模版


指标功能:[B]国产软件[/B]
指标类型:简体中文
所需积分:0
推荐星级:
授权方式:共享版
公式大小:0 Bytes
更新时间:2013-03-01 08:47:00
公式简介:

使用说明:

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


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

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

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

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


[url=http://www.goodgupiao.com/gupiaogongshi/26304.html][B]移动止损模版[/B][/url]