求教如何表达:
日内连亏N次之后,平仓离场,当日不再交易;次日重新遵循原系统开始。
varaible:n=0;
if numprofit(1)<0 and numprofit(2)<0 and ref(平多条件,1) and ref(holding>0,1) and holding<=0 then begin
n:=N+1;
end
if numprofit(1)<0 and numprofit(2)<0 and ref(平空条件,1) and ref(holding<0,1) and holding>=0 then begin
n:=N+1;
end
if time=closetime(0) then n:=0;
if n>=既定的连亏次数 then exit;
if numprofit(1)<0 and numprofit(2)<0 and ref(平多条件,1) and ref(holding>0,1) and holding<=0 then begin
numprofit(1)<0 and numprofit(2)<0判断连亏
ref(平多条件,1) and ref(holding>0,1) and holding<=0判断上根k线是否平仓
连亏+平仓,都满足之后,才能记录连亏的次数