当前位置:首页 > 公式解答 > 内容

n日内涨幅问题

作者:公式指标网   更新时间:2019-03-07   点击:

编写要求:

 

www.gszx.com.cn网解答:

 网友求助:

求100日内涨幅最大的前50个交易日涨幅总和,这个公式怎么编写?
 
 
解答如下:
input:n(100,1,9999);
wx:=barslast(barpos=0);
nn:=wx;
if datacount<n then begin
nn:=datacount-1;
end else begin
nn:=n;
end;
ZF:=(c/ref(c,1)-1)*100;
dt:=datacount;
tmp:=sort(ZF,0, dt-nn+1,dt);
ZFv:=(c/ref(c,1)-1)*100;
sp:=c*0;
for i=dt downto dt-nn+1 do begin
for j=dt downto dt-nn+1 do begin
if ZFv[j]=ZF[i] then
sp[j]:=i;
end;
end;
ZFp:=if(sp-(dt-nn)>=50,ZFv,0);
涨幅总和:sum(ZFp,0);
 

资源下载

相关文章

热门推荐

移动端首页 | PC端

© by gszx.com.cn Mobile Web