variable:bj=0;
if bj=0 and 开多条件 and holding=0 then buy......;
if 止盈条件 and holding>0 then begin
sell......;
n:=1;
end
if 开空条件 and holding=0 then begin
buyshort...;
n:=0;
end
variable:bj_duo=0,bj_kong=0;
if bj_duo=0 and 开多条件 and holding=0 then buy......;
if bj_kong=0 and 开空条件 and holding=0 then buyshort......;
if 止盈条件 and holding<0 then begin
sellshort......;
bj_kong:=1;
end
if 止盈条件 and holding>0 then begin
sell......;
bj_duo:=1;
end
if 开空条件 and holding=0 then begin
buyshort...;
bj_duo:=0;
end
if 开多条件 and holding=0 then begin
buy...;
bj_kong:=0;
end