variable:zs=c,maxhl=c;
//把以上顾比线的代码复制一下
DISTL:=NEWLBARS(L,1);
DISTH:=NEWHBARS(H,1);
HI20:=REF(HHV(H,20),1);
LO20:=REF(LLV(L,20),1);
GBD1:=REF(L,DISTL);
GBD2:=REF(GBD1,DISTL);
GBD:=IF(GBD2>0,MAX(LLV(L,20),GBD2),LLV(L,20));
GBG1:=REF(H,DISTH);
GBG2:=REF(GBG1,DISTH);
GBG:=IF(GBG2>0,MIN(HHV(H,20),GBG2),HHV(H,20));
nn:=barslast(date<>ref(date,1))+1;
entertime:=nn>=m and time<=144500;
exittime:=time>=150900;
if holding>0 then 止损1:zs;
if holding<0 then 止损2:zs;
ma5:=ma(c,5);
ma30:=ma(c,30);
long:=cross(ma5,ma30);//多单进场条件
short:=cross(ma30,ma5);//空单进场条件
//下破移动止损线后离场
if holding>0 and (c<zs or exittime) then sell(1,1,limitr,c);
if holding<0 and (c>zs or exittime) then sellshort(1,1,limitr,c);
//开仓语句
if holding=0 and entertime and long then begin
buy(1,1,limitr,c);
zs:=gbd;//调用顾比倒数线做为止损
maxhl:=h;//记录当时的高点
end
if holding=0 and entertime and short then begin
buyshort(1,1,limitr,c);
zs:=gbg;//调用顾比倒数线做为止损
maxhl:=L;
end
if holding<0 and l<maxhl then begin //创新低后,重新定位离场位,以实现浮动止损
maxhl:=l;
zs:=gbg;
end
if holding>0 and h>maxhl then begin //创新高后,重新定位离场位,以实现浮动止损
zs:=gbd;
maxhl:=h;
end
这是在那个帖子第8楼阿火版主的这个策略16行有个问题,编译时显示:未定义的变量M,这个m我改成了090500就没问题了。
是不是这个策略缺少一些参数的设定。所以在运行起来没啥显示啊?