M1:=125;
KZZ:=CODELIKE('11') OR CODELIKE('12');{可转债}
Z1:=IF(INBLOCK('科创板') OR INBLOCK('创业板') OR KZZ,0.2,IF(INBLOCK('ST板块'),0.05,IF(INBLOCK('北证A股'),0.3,0.1)));{取涨停值}
ZTJ:=ZTPRICE(REF(C,1),Z1);{计算当前K线的涨停价}
T1:=ZTJ=C;{涨停}
T2:=ZTJ=H AND C<H;{炸板}
P1:=ZTPRICE(REF(C,2),Z1);{前一个交易日的涨停价}
P2:=ZTPRICE(REF(C,3),Z1);{前两个交易日的涨停价}
S1:=IF(T1,CURRBARSCOUNT-1,DRAWNULL);{返回涨停距今交易日}
S2:=IF(T2,CURRBARSCOUNT-1,DRAWNULL);{返回炸板距今交易日}
ZT:=T1 AND REF(C,1)< P1 AND O<ZTJ AND S1<=M1;{距今M1个交易日内的非一字首板}
ZB:=T2 AND REF(C,1)< P1 AND O<ZTJ AND S2<=M1;{距今M1个交易日内的非一字首板炸板}
ZTS:=COUNT(ZT,0);{满足ZT条件的涨停次数}
ZBS:=COUNT(ZB,0);{满足ZB条件的炸板次数}
ZQ:=IF(REF(C,1)=P1,CURRBARSCOUNT-1,DRAWNULL);{前一交易日为涨停则返回其距今的交易日}
K1:=(O/REF(C,1)-1)*100;{开盘涨跌幅}
K2:=(H/REF(C,1)-1)*100;{最高涨跌幅}
A1:=REF(C,1)=P1 AND REF(O,1)<P1 AND REF(C,2)<P2 AND ZQ<=M1;{前一个交易日为非一字首板且距今交易日不超过M1的K线}
L1:=IF(A1,K1,DRAWNULL);{返回A1的开盘涨跌幅}
L2:=IF(A1,K2,DRAWNULL);{返回A1的最高涨跌幅}
GK3:=L1>=3;{符合A1条件且开盘涨幅>=3%的K线}
YJ5:=L2>=4.95;{符合A1条件且最高涨幅>=5%的K线}
CR1:=COUNT(A1,M1);{统计符合A1条件K线的数量}
CR2:=COUNT(GK3,M1);{统计符合A1条件且开盘涨幅>=3%的K线数量}
CR3:=COUNT(YJ5,M1);{统计符合A1条件且溢价>=5%的K线数量}
XZ:=T1 AND REF(C,1)<P1 AND O<ZTJ AND S1<=M1 AND GPJYVALUE(14,2,0)<=5 AND GPJYVALUE(24,1,0)<=140000;{开板次数<=5、首次封板时间14点之前的非一字首板涨停}
FD:=IF(XZ,GPJYVALUE(24,2,0),DRAWNULL);{返回符合XZ条件涨停的最大封单额}
TJ:=COUNT(XZ,M1);{计算M1个周期内符合XZ1条件涨停次数}
ZH:=SUM(FD,M1);{求和M1个周期内符合XZ条件涨停的最大封单额}
FDE:=ZH/TJ;{M1个周期内符合XZ条件涨停的最大封单平均值}
{输出}
历史封单\亿:VALUEWHEN(FD>0,FDE/10000),COLORWHITE,NODRAW;{所需封单额的预估值};
封板率%:ZTS/(ZTS+ZBS)*100,COLOR09C9E0,NODRAW;
开盘%:SUM(L1,M1)/CR1,COLORLIGRAY,NODRAW;{开盘溢价平均值}
最高%:SUM(L2,M1)/CR1,COLORRED,NODRAW;{最高溢价平均值};
高开≥3\%:CR2/CR1*100,COLORMAGENTA,NODRAW;{高开3%以上的概率};
溢价≥5\%:CR3/CR1*100,COLORLIRED,NODRAW;{溢价5%以上的概率};