if 平多条件 and holding>0 then begin
sell(1,0,marketr);
if numprofit(1)<0 then n:=n+1;
if numprofit(1)>0 then n:=0;
end
if 平空条件 and holding<0 then begin
sellshort(1,0,marketr);
if numprofit(1)<0 then n:=n+1 ;
if numprofit(1)>0 then n:=0;
variable:n=0;
if high>n and numprofit(1)<0 then n:=high;