止盈条件 你自己修改成你自己的额,我随便写的止盈条件 只是拿来调试而已。
[PEL] 复制代码 variable:num:=0;
ma5:=ma(close, 5);
ma20:=ma(close, 20);
cond1:=ma5>ma20;
cond2:=ma5<ma20;
if cond2 and holding>0 then sell(1,1,market); //平多
if cond1 and holding=0 and num>=0 then //开多
begin
buy(1,1,market);
end
if cond1 and holding<0 then sellshort (1,1,market);//平空
if cond2 and holding=0 and num<=0 then
begin
buyshort(1,1,market); //开空
end
if openprofitper>=5 and holding>0 then
begin
多止盈:sell(1,holding,market);
num:=-1;
end
if openprofitper>=5 and holding<0 then
begin
空止盈:sellshort(1,holding,market);
num:=1;
end |