VARIABLE: buy_flag=0;
if buycond=1 and buy_flag=0 then BEGIN
buy(...),IGNORECHECKPRICE;
buy_flag:=1;
end
if buy_flag=1 and 加仓条件 then begin
buy(...),IGNORECHECKPRICE;
end
类似上面使用,全局变量进行互锁。需要注意一下2点:
1.多空的,全局标志,必须分开,不要串在一起用。
2.全局标志,需要在平完仓位等情况下(需要置零的时候)。从新置0 。否者后续无法开仓。