variable:N=0;
variable:zs=0;
if holding=0 and 开仓条件 then BEGIN
buy(1,1,limitr,指定的价格);
end
if holding>0 and c>enterprice+20 and n<5 then begin
zs:=enterprice;
buy(1,1,marketr);
n:=n+1;
end
if holding>0 and n=0 and c<enterprice-20 then begin
sell(1,0,marketr);
end
if holding>0 and n>0 and c<zs-20 then begin
sell(1,0,marketr);
n:=0;
end
这里有“平仓后加仓次数重置为0”的设定