variable:n=0;
if 平倉條件 and 持倉判斷 then begin
平倉語句;
if numprofit(1)>=0 then n:=0;
if numprofit(1)<0 then n:=n+1;
end
周期:barslast(ref(n=1,1) and n=2)+1;