variable:n=0,m=0,shoushu=1;//n记录连赢次数,m记录连亏次数,下单手术设定初始值为1
if 平仓条件 and 持仓判断 then begin
平仓语句;
if numprofit(1)>0 then begin
n:=n+1;
m:=0;
end
if numprofit(1)<0 then begin
m:=m+1;
n:=0;
end
end
if 开仓条件 and 持仓判断 and n>=4 then begin
shoushu:=1;
开仓语句,下单手数设定为shoushu
end
if 开仓条件 and 持仓判断 and m>=4 then begin
shoushu:=3;
开仓语句,下单手数设定为shoushu;
end