variable:hl=0,zs=0,zy=0;
cc:=CALLSTOCK(STKLABEL,VTCLOSE,6);
c5:=CALLSTOCK(STKLABEL,VTCLOSE,2);
jx5:=ma(cc,5);
jx20:=ma(cc,20);
jx5f5:=ma(c5,5);
jx5f20:=ma(c5,20);
sc:=cross(jx5f5,jx5f20);
xc:=cross(jx5f20,jx5f5);
if jx5>jx20 then
begin
sellshort(holding<0,0,thisclose);
buy(sc and holding=0,10,thisclose);
hl:=h;
zs:=enterprice*0.9;
zy:=enterprice*1.1;
end
if jx20>jx5 then
begin
sell(holding>0,0,thisclose);
buyshort(xc and holding=0,10,thisclose);
hl:=l;
zs:=enterprice*1.1;
zy:=enterprice*0.9;
end
if low<=zs then
sell(holding>0,0,market);
if high>=zs then
sellshort(holding<0,0,market);
if hl>zy then
sell(holding>0,50%,market);
if hl<zy then
sellshort(holding<0,50%,market);
最后2句设定盈利达到10%的时候,平仓一半,但是系统却因满足条件一直不停的平仓,直到没有仓位,哪位高手能帮忙解决此问题啊?
if holding>0 and hl>zy then begin sell(1,50%,market);hl:=drawnull;end
if holding<0 and hl<zy then begin sellshort(1,50%,market); hl:=drawnull;end