大体上是这样的:开多条件加上exitbars>0,开空条件加上enterbars>0,但是要做特殊处理,避免没有任何的开仓
variable:n=0;
if n=0 and holding=0 and 开多条件 then begin
buy.........;
n:=1;
end
if n=0 and holding=0 and 开空条件 then begin
buyshort.........;
n:=1;
end
if n>0 and 开多条件 and exitbars>0 then buy........;
if N>0 and 开空条件 and exitbars>0 then buyshort.......;
if 平多条件 and enterbars>0 then sell.....;
if 平空条件 and enterbars>0 then sellshort........;