平仓条件就是持仓7天?
variable:kd=0,kk=0;
开多条件里面加上kd=0;开空条件里面加上kk=0;
tt:=ref(todaybar,todaybar);
if holding>0 and barslast(holding>0 and ref(holding=0,1))>tt*7 and 平多条件 then begin
sell(1,0,market);
kd:=1;
end
if c<ma(c,60) then kd:=0;
if holding<0 and barslast(holding<0 and ref(holding=0,1))>tt*7 and 平空条件 then begin
sell(short1,0,market);
kk:=1;
end
if c>ma(c,60) then kk:=0;