variable:n=0,m=0;
if holding>0 and 平多条件 then begin
sell(1,0,marketr);
n:=n+1;
if numprofit(1)>0 then m:=m+1;
end
if holding<0 and 平多条件 then begin
sellshort(1,0,marketr);
n:=n+1;
if numprofit(1)>0 then m:=m+1;
end
然后胜率就是m/n;
n用来记录交易总次数,m用来记录盈利的次数
那你的需求就不行了,取不到
nn:=sumbars(胜率<>ref(胜率,1),10);
ss:=if(胜率<>ref(胜率,1),胜率,0);
10个的均值就是
sum(ss,nn+1)/10