序列排序:
runmode:1;
bkname:=\连续合约\;
stks:=stkcount(bkname);
variable:stklabels[stks]=0;
variable:stktrades[stks]=0;
for i=1 to stks do begin
code:=stkfromblk(bkname,i);
stklabels[i]:=strremove(code,0,2);
stktrades[i]:=(callstock(stklabels[i],vthigh,-1,0)-callstock(stklabels[i],vtlow,-1,0))/callstock(stklabels[i],vtopen,-1,0)*100;
end
p:=sortpos(stktrades,1,1,stks);
for i=1 to stks do begin
if stricmp(stklabel,stklabels[stktrades[i]])=0 then
mypos:=i;
end
序列位置:mypos,linethick0;
逐K排序
runmode:0;
bkname:=\连续合约\;
stks:=stkcount(bkname);
variable:stklabels[stks]=0;
variable:stktrades[stks]=0;
variable:stkposes[stks]=0;
for i=1 to stks do begin
code:=stkfromblk(bkname,i);
stklabels[i]:=strremove(code,0,2);
stktrades[i]:=(callstock(stklabels[i],vthigh,-1,0)-callstock(stklabels[i],vtlow,-1,0))/callstock(stklabels[i],vtopen,-1,0)*100;
if stktrades[i]>0 then
stktrades[i]:=stktrades[i];
else
stktrades[i]:=0;
stkposes[i]:=i;
end
for i=1 to stks do begin
for j=1 to stks-i do begin
if stktrades[j] then begin
t1:=stktrades[j];
stktrades[j]:=stktrades[j+1];
stktrades[j+1]:=t1;
t2:=stkposes[j];
stkposes[j]:=stkposes[j+1];
stkposes[j+1]:=t2;
end
end
end
for i=1 to stks do begin
if stricmp(stklabel,stklabels[stkposes[i]])=0 then
mypos:=i;
end
逐K位置:mypos,linethick0;