variable:bj=0;
if 开多条件1 and holding=0 and bj=0 then begin
bj:=1;
buy(1,1,thisclose);
end
if 开多条件2 and holding=0 and bj=0 then begin
bj:=2;
buy(1,1,thisclose);
end
if 平多条件1 and holding>0 and bj=1 then begin
sell(1,0,thisclose);
bj:=0;
end
if 平多条件2 and holding>0 and bj=2 then begin
sell(1,0,thisclose);
bj:=0;
end
用全局变量定义个BJ,BJ=0时可以开仓,=1时平开多条件1的仓,=2时平开多条件2的仓
if 平多条件1 and holding>0 and bj=1 then begin
sell(1,0,thisclose);
bj:=0;
playsound(1,'声音文件1路径');
end
if 平多条件2 and holding>0 and bj=2 then begin
sell(1,0,thisclose);
bj:=0;
playsound(2,'声音文件2路径');
end