国庆送大礼,祝同学们一路凯歌168、168、16888!!!
领涨板块及个股排序
领涨板块及个股排序---飞狐副图,引用网友bajatje(懒汉)及网友1949提供的指标,谢谢懒汉及1949网友
1.板块指数需盘中浏览、刷新之后,显示的结果才是正确的。
2.指标公式运行错误,最根本的原因可能是找不到板块名称、板块指数或自选股数量少于9个。
{//涨幅引用xx
HH:HIGH;LL:LOW;CC:CLOSE;
A0:DYNAINFO(14)*100;
DD:DATE;
ZDF:(CC/REF(CC,1)-1)*100;
HSH:VOL/IF(CAPITAL>0,CAPITAL,SUM(VOL,120))*100;
//}
{先单独建立上面指标名为"涨幅引用xx"的指标,再建下列指标}
///////////////////////////////////////////////////////////
{领涨板块及个股排序---飞狐副图,引用网友bajatje(懒汉)及网友1949提供的指标,谢谢懒汉及1949网友}
//////////////////////////////////////////////////////////
{当前个股所在板块内个股排序,引用网友bajatje(懒汉)提供的指标,谢谢懒汉网友}
INPUT:X(1,1,3);
RQ:=DATE;//取日期
A:=BLKNAME;
HY:=IF(STRFIND(A,',',1)>0,STRLEFT(A,STRFIND(A,',',1)-1),A);//DRAWTEXT(BARPOS=SYSPARAM(2),2,HY);
HYs:=STKCOUNT(HY);
DYZB:=IF(X=1,'涨幅引用xx.ZDF',IF(X=2,'涨幅引用xx.HSH','涨幅引用xx.CC'));
DAS:=DATACOUNT;
D0:=RQ[DAS];//取最后日期
variable:DM[HYs]='',vcp[HYs]=0,vci[HYs]=0,TP=0;
for k=1 to HYs do begin
DDD:=STKFROMBLK(HY,k);
DM[k]:=DDD;
TMP:=STKINDI(DDD,DYZB,0,6);
TMPD:=STKINDI(DDD,'涨幅引用xx.DD',0,6);
vcp[k]:=TMP[DAS];
vci[k]:=IF(TMPD[DAS]=D0,TMP[DAS],-1000);//去除当天停牌股
TP:=TP+IF(vci[k]=-1000,1,0);
end;
PX1:=SORTPOS(vci,1,1,HYs);
KHYS:=HYS-TP,LINETHICK;
BKXS:='当前股所属行业: '+HY+' 包含个股数:'+NUMTOSTR(HYs,0);
ZF:=IF(X=3,' 元',' %');
LBS:=IF(X=3,'收盘价',IF(X=1,'涨跌幅','换手率'));
DRAWTEXT(SYSPARAM(2)=BARPOS,h,BKXS),colorAFFF,ALIGN4;
WZ:=INTPART((SYSPARAM(3)-SYSPARAM(2))/10);
HST:=' \n\n';
kg:=' ';
//
IF KHYS<2 THEN EXIT;
COL1:=HST+kg+' ①'+STKNAMEEX(DM[vci[1]])+' '+numtostr(vcp[vci[1]],2)+ZF+
' ②'+STKNAMEEX(DM[vci[2]])+' '+numtostr(vcp[vci[2]],2)+ZF+
IF(KHYS>3,' ③'+STKNAMEEX(DM[vci[3]])+' '+numtostr(vcp[vci[3]],2)+ZF,'')+
IF(KHYS>4,' ④'+STKNAMEEX(DM[vci[4]])+' '+numtostr(vcp[vci[4]],2)+ZF+' ⑤'+STKNAMEEX(DM[vci[5]])+' '+numtostr(vcp[vci[5]],2)+ZF+'\n'+kg
+' ⑥'+STKNAMEEX(DM[vci[6]])+' '+numtostr(vcp[vci[6]],2)+ZF+' ⑦'+STKNAMEEX(DM[vci[7]])+' '+numtostr(vcp[vci[7]],2)+ZF
+' ⑧'+STKNAMEEX(DM[vci[8]])+' '+numtostr(vcp[vci[8]],2)+ZF+' ⑨'+STKNAMEEX(DM[vci[9]])+' '+numtostr(vcp[vci[9]],2)+ZF
+' ⑩'+STKNAMEEX(DM[vci[10]])+' '+numtostr(vcp[vci[10]],2)+ZF,'');//领先股
COL2:=HST+HST+kg+IF(KHYS>6,' ①'+STKNAMEEX(DM[vci[KHYs]])+' '+numtostr(vcp[vci[KHYs]],2)+ZF+
' ②'+STKNAMEEX(DM[vci[KHYs-1]])+' '+numtostr(vcp[vci[KHYs-1]],2)+ZF+
' ③'+STKNAMEEX(DM[vci[KHYs-2]])+' '+numtostr(vcp[vci[KHYs-2]],2)+ZF+
' ④'+STKNAMEEX(DM[vci[KHYs-3]])+' '+numtostr(vcp[vci[KHYs-3]],2)+ZF+
' ⑤'+STKNAMEEX(DM[vci[KHYs-4]])+' '+numtostr(vcp[vci[KHYs-4]],2)+ZF+'\n'+kg+
' ⑥'+STKNAMEEX(DM[vci[KHYs-5]])+' '+numtostr(vcp[vci[KHYs-5]],2)+ZF+
' ⑦'+STKNAMEEX(DM[vci[KHYs-6]])+' '+numtostr(vcp[vci[KHYs-6]],2)+ZF+
' ⑧'+STKNAMEEX(DM[vci[KHYs-7]])+' '+numtostr(vcp[vci[KHYs-7]],2)+ZF+
' ⑨'+STKNAMEEX(DM[vci[KHYs-8]])+' '+numtostr(vcp[vci[KHYs-8]],2)+ZF+
' ⑩'+STKNAMEEX(DM[vci[KHYs-9]])+' '+numtostr(vcp[vci[KHYs-9]],2)+ZF,'');//滞后股
DRAWTEXT(BARPOS=SYSPARAM(2),h,HST+'领先股:'),COLORred,ALIGN4;
DRAWTEXT(BARPOS=SYSPARAM(2),h,COL1),Colorred,ALIGN4;
DRAWTEXT(BARPOS=SYSPARAM(2),h,HST+HST+HST+'滞后股:'),COLORFF00,ALIGN4;
DRAWTEXT(BARPOS=SYSPARAM(2),h,HST+COL2
+'\n'+'*********************************************************************************************************************************'),COLORFFFF00,ALIGN4;
//////////////////////////////////////////////////////////////
{指定板块内个股排序,引用网友bajatje(懒汉)提供的指标,谢谢懒汉网友}
bk:='自选股'; //可任意指定版块,板块内个股数需大于9个
stksum:=STKCOUNT(bk);dcount:=DATACOUNT;yygs4:='涨幅引用xx.A0';
variable:dmstr[stksum]='',var_px[stksum]=0,var_indi[stksum]=0;
for k=1 to stksum do
begin
dn:=stkfromblk(bk,k);
dmstr[k]:=dn;
temp1:=stkindi(dn,yygs4,0,-1);
var_px[k]:=temp1[dcount];
var_indi[k]:=temp1[dcount];
end;
Num1:=sortpos(var_indi,1,1,stksum);
dm_max1:=var_indi[1];dm_max2:=var_indi[2];dm_max3:=var_indi[3];dm_max4:=var_indi[4];
dm_max5:=var_indi[5];dm_max6:=var_indi[6];dm_max7:=var_indi[7];dm_max8:=var_indi[8];
max1:=var_px[dm_max1];max2:=var_px[dm_max2];max3:=var_px[dm_max3];
max4:=var_px[dm_max4];max5:=var_px[dm_max5];max6:=var_px[dm_max6];max7:=var_px[dm_max7];
max8:=var_px[dm_max8];
DRAWTEXT(BARPOS=SYSPARAM(2),100,hst+hst+hst+hst+hst+hst+'自选前排序%'+'['+STKNAMEEX(dmstr[dm_max1])+''+NUMTOSTR(max1,2)
+']['+STKNAMEEX(dmstr[dm_max2])+''+NUMTOSTR(max2,2)
+']['+STKNAMEEX(dmstr[dm_max3])+''+NUMTOSTR(max3,2)
+']['+STKNAMEEX(dmstr[dm_max4])+''+NUMTOSTR(max4,2)
+']['+STKNAMEEX(dmstr[dm_max5])+''+NUMTOSTR(max5,2)
+']['+STKNAMEEX(dmstr[dm_max6])+''+NUMTOSTR(max6,2)
+']['+STKNAMEEX(dmstr[dm_max7])+''+NUMTOSTR(max7,2)
+']['+STKNAMEEX(dmstr[dm_max8])+''+NUMTOSTR(max8,2)
+']'),ColorFF99ff,align4;
yygs5:='涨幅引用xx.A0';
variable:dmstr[stksum]='',var_px[stksum]=0,var_indi[stksum]=0;
for k=1 to stksum do
begin
dn:=stkfromblk(bk,k);
dmstr[k]:=dn;
temp1:=stkindi(dn,yygs5,0,-1);
var_px[k]:=temp1[dcount];
var_indi[k]:=temp1[dcount];
end;
Num1:=sortpos(var_indi,0,1,stksum);
dm_max1:=var_indi[1];dm_max2:=var_indi[2];dm_max3:=var_indi[3];dm_max4:=var_indi[4];
dm_max5:=var_indi[5];dm_max6:=var_indi[6];dm_max7:=var_indi[7];dm_max8:=var_indi[8];
max1:=var_px[dm_max1];max2:=var_px[dm_max2];max3:=var_px[dm_max3];
max4:=var_px[dm_max4];max5:=var_px[dm_max5];max6:=var_px[dm_max6];max7:=var_px[dm_max7];
max8:=var_px[dm_max8];
DRAWTEXT(BARPOS=SYSPARAM(2),h,hst+hst+hst+hst+hst+hst+hst+'自选后排序%'+'['+STKNAMEEX(dmstr[dm_max1])+''+NUMTOSTR(max1,2)
+']['+STKNAMEEX(dmstr[dm_max2])+''+NU |