行业板块情况
调整参数可改变板块内横向比较的指标,更换对比的所属板块情况
主公式
{行业板块情况}
INPUT:X(1,1,3),指定(2,1,15);
TT:=STKTYPE=0 OR STKTYPE=13;
DRAWTEXT(BARPOS=SYSPARAM(2)+5 AND TT,C,'本公式不在指数中使用,请在个股中应用'),COLOREEFF,ALIGN4;
IF TT THEN EXIT;
RQ:=DATE;//取日期
{显示指定板块}
Vb:=BLKNAME;{所属板块提取}
Vl:=STRLEN(Vb);
IF Vl<4 THEN EXIT;
Fs:=CEILING(Vl/5),LINETHICK;
M:=IF(指定>FS,FS,指定);
n:=1;
VARIABLE:Dt[Fs]=0;
For i=1 TO Fs do begin
Dt[i]:=STRFIND(vb,',',N);
N:=Dt[i]+1;
END;
HY:=RTRIM(LTRIM(IF(M=1,STRLEFT(Vb,Dt[M]-1),STRMID(Vb,Dt[M-1]+1,Dt[M]-Dt[M-1]-1))));
IF Fs>15 THEN BKT:=STRLEFT(Vb,Dt[15]-1); ELSE BKT:=Vb;
DRAWTEXT(SYSPARAM(2)=BARPOS,-0.5,' \n'+BKT),PXDN15,COLORAAAAA0;
//DRAWTEXT(SYSPARAM(2)=BARPOS,0,' \n \n所属第'+NUMTOSTR(M,0)+'个板块: '+HY),ALIGN4,COLORGREEN;
HYs:=STKCOUNT(HY);//板块股数量
DYZB:=IF(X=1,'HQSJ.ZDF',IF(X=2,'HQSJ.HSH','HQSJ.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,'HQSJ.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);//降序排列
//PX2:=SORTPOS(vcp,1,1,HYs);
KHYS:=HYS-TP,LINETHICK;//板块实际开盘股票
今开盘数:KHYS,LINETHICK;
BKXS:='所属行业: '+HY+' 包含个股数:'+NUMTOSTR(HYs,0);
ZF:=IF(X=3,' 元',' %');
LBS:=IF(X=3,'收盘价',IF(X=1,'涨跌幅','换手率'));
DRAWTEXT(SYSPARAM(2)=BARPOS,8,BKXS),colorffff00;
WZ:=' ';KG:=' ';//INTPART((SYSPARAM(3)-SYSPARAM(2))/6);
WZ2:=STRLEFT(WZ,16);
IF KHYS<2 THEN EXIT;
-2,COLOR;
EXPLAIN(1,LBS+'领先股'),COLORFF00;
EXPLAIN(1,' ①'+STKNAMEEX(DM[vci[1]])+' '+numtostr(vcp[vci[1]],2)+ZF),Coloryellow;
EXPLAIN(1,' ②'+STKNAMEEX(DM[vci[2]])+' '+numtostr(vcp[vci[2]],2)+ZF),Coloryellow;
DRAWTEXT(BARPOS=SYSPARAM(2),5,LBS+'领先股:'),COLORFF00;
DRAWTEXT(BARPOS=SYSPARAM(2),5,WZ2+' ①'+STKNAMEEX(DM[vci[1]])+' '+STRRIGHT(' '+numtostr(vcp[vci[1]],2),6)+ZF+KG+' ②'+STKNAMEEX(DM[vci[2]])+' '+STRRIGHT(' '+numtostr(vcp[vci[2]],2),6)+ZF),Coloryellow;
IF KHYS<3 THEN EXIT;
EXPLAIN(1,' ③'+STKNAMEEX(DM[vci[3]])+' '+numtostr(vcp[vci[3]],2)+ZF),Coloryellow;
DRAWTEXT(BARPOS=SYSPARAM(2),5,WZ+WZ+' ③'+STKNAMEEX(DM[vci[3]])+' '+STRRIGHT(' '+numtostr(vcp[vci[3]],2),6)+ZF),Coloryellow;
IF KHYS<4 THEN EXIT;
EXPLAIN(1,' ④'+STKNAMEEX(DM[vci[4]])+' '+numtostr(vcp[vci[4]],2)+ZF),Coloryellow;
DRAWTEXT(BARPOS=SYSPARAM(2),5,WZ+WZ+WZ2+' '+' ④'+STKNAMEEX(DM[vci[4]])+' '+STRRIGHT(' '+numtostr(vcp[vci[4]],2),6)+ZF),Coloryellow;
IF KHYS<6 THEN EXIT;
EXPLAIN(1,LBS+'滞后股'),COLORFF00;
EXPLAIN(1,' ①'+STKNAMEEX(DM[vci[KHYs]])+' '+numtostr(vcp[vci[KHYs]],2)+ZF+' \n ②'+STKNAMEEX(DM[vci[KHYs-1]])+' '+numtostr(vcp[vci[KHYs-1]],2)+ZF+' \n ③'+
STKNAMEEX(DM[vci[KHYs-2]])+' '+numtostr(vcp[vci[KHYs-2]],2)+ZF+' \n ④'+STKNAMEEX(DM[vci[KHYs-3]])+' '+numtostr(vcp[vci[KHYs-3]],2)+ZF),ColorFFFF00;
DRAWTEXT(BARPOS=SYSPARAM(2),2,LBS+'滞后股:'),COLORFF00;
DRAWTEXT(BARPOS=SYSPARAM(2),2,WZ2+' ①'+STKNAMEEX(DM[vci[KHYs]])+' '+STRRIGHT(' '+numtostr(vcp[vci[KHYs]],2),6)+ZF+KG+' ②'+STKNAMEEX(DM[vci[KHYs-1]])+' '+STRRIGHT(' '+numtostr(vcp[vci[KHYs-1]],2),6)+ZF+KG+' ③'+
STKNAMEEX(DM[vci[KHYs-2]])+' '+STRRIGHT(' '+numtostr(vcp[vci[KHYs-2]],2),6)+ZF+KG+' ④'+STKNAMEEX(DM[vci[KHYs-3]])+' '+STRRIGHT(' '+numtostr(vcp[vci[KHYs-3]],2),6)+ZF),ColorFFFF00;
//
{参数精灵:
排序类别:Param#1
1- 涨跌幅 2-换手率 3- 收盘价
引用公式:
{HQSJ}
CC:CLOSE;HH:HIGH;LL:LOW;OO:OPEN;
DD:DATE;D0:ref(DD,1);TT:TIME;
ZDF:(CC/REF(CC,1)-1)*100;
HSH:VOL/IF(CAPITAL>0,CAPITAL,SUM(VOL,120))*100;
前收:REF(CC,1);
MA5:MA(CC,5);MA10:MA(CC,10);
P:BARPOS,LINETHICK;
HLL:WINNER(CLOSE);
量:VOL;额:AMOUNT;
LTP:CAPITAL,LINETHICK;
HS:DYNAINFO(37);
FF:C>MA(C,30);
SS:OPENMINUTES(TIME);//分时开盘分钟数
RH:REF(HH,1);
涨:INDEXADV;
跌:INDEXDEC;
//期货
IF STKTYPE=7 THEN 仓:OPENINT;
//
|