variable:n=0;
if 止盈止损 then
begin
sell();
n:=1;
end
if 开仓条件 and n=1 then
begin
buy();
end
if time =150000 then n:=0;
楼上笔误,用这个
variable:n=0;
if 开仓条件 and n=0 then
begin
buy();
end
if 止盈止损 then
begin
sell();
n:=1;
end
if time =closetime(0) then n:=0;
variable:n=0; if 多单止盈 then begin sell(); n:=1; end
if 空单止盈 then begin sellshort(); n:=1; end if 多单开仓条件 and n=0 then begin buy(); end f 空单开仓条件 and n=0 then begin buyshort(); end
if time =150000 then n:=0; |
上边是开多的例子,也有开空的话再加一个变量
variable:n=0,m=0;
if 多单止盈 then
begin
sell();
n:=1;
end
if 空单止盈 then
begin
sellshort();
m:=1;
end
if 多单开仓条件 and n=0 then
begin
buy();
end
if 空单开仓条件 and m=0 then
begin
buyshort();
end
if time =closetime(0) then begin
n:=0;
m:=0;
end