runmode:0;
variable:n[30]=0;
n:=9;p1:=3;ss:=0;t:=0;
RSV:=(CLOSE-LLV(LOW,N))/(HHV(HIGH,N)-LLV(LOW,N))*100;
K:SMA(RSV,P1,1);
vv:vol;
{1、在1分钟周期上,得到每分钟的K值(kdj中的k)。
2、取最近的30个周期,按照K值大小来排序。
3、取得30个周期的成交量总量,比如总量为1000万,取20%,即200万。以K值从大到小,取得前面的N根k线,其成交量累加达到200万。
4、例如,K值从大到小排列之后,发现前面8根K线,成交量相加之后达到了200万。那么就取这8根K线。
5、计算这8根K线的按成交量加权的平均价。 }
s30:=sum(vol,30);
nn:=s30*0.2;
for i=1 to 30 do begin
for j=1 to 30 do begin
if k[barpos-j+1]=large(k,30,i) then n[i]:=vv[j];
end
end
for m=1 to 30 do begin
if ss<s30 then ss:=ss+n[m];
if ss>=s30 then begin
t:=m; break;
end
end
t为所求的"8"
for m=1 to 30 do begin
if ss<s30 then ss:=ss+n[m];
if ss>=s30 then begin
t:=m; break;
end
end
这里的s30改成nn,这里是笔误不好意思