要用全局变量来记录
variable:ly=0,lk=0;
if 平多条件 and holding>0 then begin
sell(1,0,thisclose);
if numprofit(1)>0 then begin
ly:=ly+1;
lk:=0;
end
if numprofit(1)<0 then begin
ly:=0;
lk:=lk+1;
end
end
if 平空条件 and holding<0 then begin
sellshort(1,0,thisclose);
if numprofit(1)>0 then begin
ly:=ly+1;
lk:=0;
end
if numprofit(1)<0 then begin
ly:=0;
lk:=lk+1;
end
end
ly为连赢次数,lk为连亏次数