多头回落平仓:开多后超过20个周期以后,如果价格从最高点回落超过8%,则平多;
空头回落平仓:开空后超过20个周期以后,如果价格从最低点上升超过8%,则平空;
//开多超过20周期
cond1 := barslast(开多条件)>20;
cond2 := barslast(开空条件)>20;
价格最高点回落8%
//variable:hh=0;
if 开多条件 then begin
buy();
hh:=h;
end
if h>hh then hh:=h;
if (hh-c)/hh>0.08 and cond1 then begin
sell();
end
//最低点回升8%
variable:ll=0;
if 开空条件 then begin
buyshort();;
ll:=l;
end
if l<ll then ll:=l;
if (c-l)/l>0.08 and cond2 then
sellshort();
end
已经解决,谢谢