variable:flag=0;
hi30:=ref(hhv(h,30),1);
lo30:=ref(llv(l,30),1);
diff:=ema(close,12) - ema(close,26);
dea:=ema(diff,9);
sc:=cross(dea,diff);
jc:=cross(diff,dea);
hi30_diff:=ref(hhv(diff,30),1);
lo30_diff:=ref(llv(diff,30),1);
if flag<>-1 and h>hi30 and diff<hi30_diff then begin
flag:=-1;
kpos:=barpos;
end
if flag<>1 and l<lo30 and diff>lo30_diff then begin
flag:=1;
kpos:=barpos;
end
if holding>0 and cross(dea,diff) then begin
sell(1,1,limitr,c);
flag:=0;
end
if holding<0 and cross(diff,dea) then begin
sellshort(1,1,limitr,c);
flag:=0;
end
if flag=1 and holding=0 then begin
if barpos-kpos<=10 and jc then begin
buy(1,1,limitr,c);
end
if barpos-kpos=10 then flag:=0;
end
if flag=-1 and holding=0 then begin
if barpos-kpos<=10 and sc then begin
buyshort(1,1,limitr,c);
end
if barpos-kpos=10 then flag:=0;
end
zichan:asset,noaxis;
if barpos=1 then begin
MaxAsset:=zichan;
hc:=0;
end
if zichan>MaxAsset then MaxAsset:=zichan;
if MaxAsset-zichan>hc then hc:=MaxAsset-zichan;
Maxhc:hc,linethick0;
交易次数:totaltrade,linethick0;
正确率:percentwin,linethick0;
[此贴子已经被作者于2011-12-1 12:58:38编辑过]