{涨停与炸板}
SHZB:=INBLOCK('上证A股') AND INBLOCK('科创板')=0;{上证主板}KCB:=INBLOCK('科创板');SZZB:=INBLOCK('深证A股') AND INBLOCK('创业板')=0;{深证主板}CYB:=INBLOCK('创业板');BZ:=INBLOCK('北证A股');ST:=INBLOCK('ST板块');KZZ:=CODELIKE('11') OR CODELIKE('12');{可转债}FSCST:=ST AND CYB=0 AND KCB=0;GP:=SHZB OR KCB OR SZZB OR CYB;L1:=IF(KCB OR KZZ OR CYB,0.2,IF(ST,0.05,IF(BZ,0.3,0.1)));ZTJ:=ZTPRICE(REF(CLOSE,1),L1);{计算当前K线的涨停价}Z1:=ZTJ=C;{涨停}Z2:=ZTJ=H AND C < H;{炸板}STICKLINE(GP OR KZZ OR BZ AND Z1 AND PERIOD=5,C,O,-1,0),COLORMAGENTA;STICKLINE(GP OR KZZ OR BZ AND Z2 AND PERIOD=5,C,O,-1,0),RGBXF1C232;
{异动提示}PLZ:=IF(KCB OR CYB,30,20);{各市场股票构成异动所对应的涨幅偏离值}TM:=IF(SHZB AND DATE>=1230410,1,IF(SZZB AND DATE>=1220711,1,0));{上证主板、深证主板全面注册制异动新规实施时间}GGLJ2:=SUM((C/REF(C,1)-1),2)*100;{个股两日累加涨跌幅}{适用于全面注册制异动新规实施前}GGLJ3:=SUM((C/REF(C,1)-1),3)*100;{个股三日累加涨跌幅}GGQJ2:=(C/REF(C,2)-1)*100;{个股两日区间涨跌幅}{适用于全面注册制异动新规实施后}GGQJ3:=(C/REF(C,3)-1)*100;{个股三日区间涨跌幅}ZSLJ2:=IF(SHZB,SUM("999998$C"/REF("999998$C",1)-1,2),IF(SZZB,SUM("399106$C"/REF("399106$C",1)-1,2),0))*100;{A股指数、深证A指两日累加涨跌幅}{适用于全面注册制异动新规实施前}ZSLJ3:=IF(SHZB,SUM("999998$C"/REF("999998$C",1)-1,3),IF(SZZB,SUM("399106$C"/REF("399106$C",1)-1,3),0))*100;{A股指数、深证A指三日累加涨跌幅}ZSQJ2:=IF(SHZB,"999998$C"/REF("999998$C",2)-1,"399107$C"/REF("399107$C",2)-1)*100;{A股指数、深证A指两日区间涨跌幅}{适用于全面注册制异动新规实施后}ZSQJ3:=IF(SHZB,"999998$C"/REF("999998$C",3)-1,"399107$C"/REF("399107$C",3)-1)*100;{A股指数、深证A指三日区间涨跌幅}XXQJ2:=IF(CYB,"399102$C"/REF("399102$C",2)-1,IF(KCB,"SH000688$C"/REF("SH000688$C",2)-1,0))*100;{创业板综、科创50两日区间涨跌幅}XXQJ3:=IF(CYB,"399102$C"/REF("399102$C",3)-1,IF(KCB,"SH000688$C"/REF("SH000688$C",3)-1,0))*100;{创业板综、科创50三日区间涨跌幅}R2:=IF(KCB OR CYB,GGQJ2-XXQJ2>=PLZ,IF(TM=0,GGLJ2-ZSLJ2>=PLZ,GGQJ2-ZSQJ2>=PLZ));{个股两日异动}R3:=IF(KCB OR CYB,GGQJ3-XXQJ3>=PLZ,IF(TM=0,GGLJ3-ZSLJ3>=PLZ,GGQJ3-ZSQJ3>=PLZ));{个股三日异动}
TP:=FINANCE(84)+1=DAYSTOTODAY;{停牌判定}TPJJ:=BARSLAST(TP);
{10个交易日内的连续同向异动统计}YD:=R2 OR R3;TYD1:=R2 AND TPJJ=2;TYD2:=R3 AND TPJJ=3 AND EXISTR(TYD1,1,1)=0;TYD:=TYD1 OR TYD2;YD11:=YD AND EXISTR(YD,5,1)=0 AND EXISTR(TP,5,1)=0 AND COUNT(AMO>0,0)>5;{前5日内无异动,且上市天数大于5}{10日内第1次异动}YD12:=TYD AND COUNT(AMO>0,0)>5;YD1:=YD11 OR YD12;SJ1:=BARSLAST(YD1);{第一次异动距今交易日}
T1:=R2 AND SJ1>=2;{若第二次异动为两日异动,则距离第一次异动至少两个交易日}T2:=R3 AND SJ1>=3 AND REF(T1,1)=0;{若第二次异动为三日异动,则距离第一次异动至少三个交易日}{前一日不存在两日异动}YD2:=T1 OR T2 AND COUNT(T1 OR T2,SJ1)=1 AND SJ1<=9;{第一次异动至今,两日或三日异动有且只有一次}{且距离第一次异动不超过9个交易日}{10日内第2次异动}SJ2:=BARSLAST(YD2);{第二次异动距今交易日}
T3:=R2 AND SJ2>=2 AND SJ2<SJ1;T4:=R3 AND SJ2>=3 AND SJ2<SJ1 AND REF(T3,1)=0;YD3:=T3 OR T4 AND COUNT(T3 OR T4,SJ1)=1 AND SJ1<=9;{10日内第3次异动}SJ3:=BARSLAST(YD3);
T5:=R2 AND SJ3>=2 AND SJ3<SJ2 AND SJ2<SJ1;T6:=R3 AND SJ3>=3 AND SJ3<SJ2 AND SJ2<SJ1 AND REF(T5,1)=0;YD4:=T5 OR T6 AND COUNT(T5 OR T6,SJ1)=1 AND SJ1<=9;{10日内第4次异动}{触发10个交易日内连续四次同向严重异动}SJ4:=BARSLAST(YD4);
T7:=R2 AND SJ4>=2 AND SJ4<SJ3 AND SJ3<SJ2 AND SJ2<SJ1;YD5:=T7 AND COUNT(T7,SJ1)=1 AND SJ1<=9;{10日内第5次异动}SJ5:=BARSLAST(YD5);
{10个、30个交易日内涨幅偏离值分别达到100%、200%统计}W1:=IF(EXISTR(TP,10,1)=0,LLVBARS(C,11),TPJJ);{11个交易日内最低收盘价距今周期数}W2:=IF(EXISTR(TP,30,1)=0,LLVBARS(C,31),TPJJ);{31个交易日内最低收盘价距今周期数}V1:=C/REF(C,W1)-1;{个股11个交易日内最低收盘价距今涨跌幅}V2:=C/REF(C,W2)-1;{个股31个交易日内最低收盘价距今涨跌幅}P1:=IF(SHZB,"999998$C"/REF("999998$C",W1)-1,IF(CYB,"399102$C"/REF("399102$C",W1)-1,IF(KCB,"SH000688$C"/REF("SH000688$C",W1)-1,"399107$C"/REF("399107$C",W1)-1)));{W1期间指数涨跌幅}P2:=IF(SHZB,"999998$C"/REF("999998$C",W2)-1,IF(CYB,"399102$C"/REF("399102$C",W2)-1,IF(KCB,"SH000688$C"/REF("SH000688$C",W2)-1,"399107$C"/REF("399107$C",W2)-1)));{W2期间指数涨跌幅}GL1:=IF(KCB OR CYB,3,6);GL2:=IF(KCB OR CYB,6,11);X1:=FILTER(V1-P1>=1,GL1);{个股10个交易日内涨幅偏离值>=100%}{其后3或6个交易日不再显示该异动}X2:=FILTER(V2-P2>=2,GL2);{个股30个交易日内涨幅偏离值>=200%}{其后6或11个交易日不再显示该异动}CY101:=X1 AND EXISTR(X1,9,1)=0 AND EXISTR(X2,9,1)=0 AND DATE>=1230103;{个股10日内首次涨幅偏离值>=100%}CYT1:=BARSLAST(CY101);{个股首次涨幅偏离值>=100%距今周期数}V3:=C/REF(C,CYT1)-1;{个股首次涨幅偏离值>=100%距今涨幅}P3:="399102$C"/REF("399102$C",CYT1)-1;{期间指数涨幅}G1:=V3-P3>=1;CY102:=G1 AND COUNT(G1,CYT1)=1 AND DATE>=1230101;{第二次涨幅偏离值大于100%}CY201:=X2 AND EXISTR(X1,29,1)=0 AND EXISTR(X2,29,1)=0;{30日内不存在涨幅严重异动,首次涨幅偏离值大于200%}G2:=V3-P3>=2;CY202:=G2 AND COUNT(G2,CYT1)=1 AND DATE>=1230101;{30日内存在10日涨幅偏离值大于100%严重异动,首次涨幅偏离值大于200%}Y1:=X1 AND EXISTR(X1,9,1)=0;Y2:=X2 AND EXISTR(X2,29,1)=0;{创业板10日内存在涨幅偏离值严重异动,重新计算异动次数}CY3:=EXISTR(Y1,9,1) OR EXISTR(Y2,9,1) AND YD3 AND CYB;CY4:=EXISTR(CY3,5,1) AND YD4 AND CYB;{超出首次10日内计数范围,但前5日存在异动,重新计数}JK1:=EXISTR(YD2,5,1) AND EXISTR(YD3,5,1)=0 AND SJ2>=2 AND SJ2<SJ1 AND R2;JK2:=EXISTR(YD2,5,1) AND EXISTR(YD3,5,1)=0 AND SJ2>=2 AND SJ2<SJ1 AND R3 AND REF(R2,1)=0;JK:=JK1 OR JK2;K1:=EXISTR(YD3,5,1) AND EXISTR(YD4,5,1)=0 AND SJ3>=2 AND SJ3<SJ2 AND SJ2<SJ1 AND R2;K2:=EXISTR(YD3,5,1) AND EXISTR(YD4,5,1)=0 AND SJ3>=3 AND SJ3<SJ2 AND SJ2<SJ1 AND R3 AND REF(R2,1)=0;J1:=K1 OR K2;K3:=EXISTR(YD4,5,1) AND EXISTR(YD5,5,1)=0 AND SJ4>=2 AND SJ4<SJ3 AND SJ3<SJ2 AND SJ2<SJ1 AND R2;K4:=EXISTR(YD4,5,1) AND EXISTR(YD5,5,1)=0 AND SJ4>=3 AND SJ4<SJ3 AND SJ3<SJ2 AND SJ2<SJ1 AND R3 AND REF(R2,1)=0;J2:=K3 OR K4;K5:=EXISTR(YD5,5,1) AND SJ5>=2 AND SJ5<SJ4 AND SJ4<SJ3 AND SJ3<SJ2 AND SJ2<SJ1 AND R2;K6:=EXISTR(YD5,5,1) AND SJ5>=3 AND SJ5<SJ4 AND SJ4<SJ3 AND SJ3<SJ2 AND SJ2<SJ1 AND R3 AND REF(R2,1)=0;J3:=K5 OR K6;YDX:=FILTER(JK OR J1 OR J2 OR J3 AND SJ1>9,3);{前5日存在异动,10日内首次异动}SJ6:=BARSLAST(YDX);U2:=R2 AND SJ6>=2;U3:=R3 AND SJ6>=3 AND REF(U2,1)=0;YDX2:=U2 OR U3 AND COUNT(U2 OR U3,SJ6)=1 AND SJ6<=9 AND EXISTR(YDX,5,1);{10日内第2次异动}SJ7:=BARSLAST(YDX2);U4:=R2 AND SJ7>=2 AND SJ7<SJ6;U5:=R3 AND SJ7>=3 AND SJ7<SJ6 AND REF(U4,1)=0;YDX3:=U4 OR U5 AND COUNT(U4 OR U5,SJ7)=1 AND SJ6<=9;{10日内第3次异动}{深证主板第4次异动}SZZB4:=EXISTR(Y1,9,1)=0 AND EXISTR(Y2,9,1)=0 AND YD4 AND SZZB;{10日内第4次异动,且前9日无严重异动}XJ:=BARSLAST(SZZB4);SZZB1:=EXISTR(Y1,9,1) OR EXISTR(Y2,9,1) AND YD4 AND SZZB;{前9日存在涨幅严重异动,重新计算异动次数}SJ8:=BARSLAST(SZZB1);B1:=R2 AND SJ8>=2;B2:=R3 AND SJ8>=3 AND REF(B1,1)=0;SZZB2:=B1 OR B2 AND COUNT(B1 OR B2,SJ8)=1 AND SJ8<=9 AND EXISTR(SZZB1,5,1);SJ9:=BARSLAST(SZZB2);B3:=R2 AND SJ9>=2 AND SJ8>SJ9;B4:=R2 AND SJ9>=3 AND SJ8>SJ9 AND REF(B3,1)=0;SZZB3:=B3 OR B4 AND COUNT(B3 OR B4,SJ9)=1 AND SJ8<=9 AND EXISTR(SZZB2,5,1);{深证主板超出首次计数范围,但前5日存在异动,重新计数}D3:=EXISTR(SZZB4,5,1) AND XJ>=2 AND XJ<SJ3 AND SJ3<SJ2 AND SJ2<SJ1 AND R2;D4:=EXISTR(SZZB4,5,1) AND XJ>=3 AND XJ<SJ3 AND SJ3<SJ2 AND SJ2<SJ1 AND R3 AND REF(R2,1)=0;D5:=D3 OR D4;SZ1:=FILTER(J1 OR D5 AND SJ1>9,3);SS1:=BARSLAST(SZ1);C1:=SS1>=2 AND R2;C2:=SS1>=3 AND R3 AND REF(C1,1)=0;SZ2:=C1 OR C2 AND COUNT(C1 OR C2,SS1)=1 AND SS1<=9 AND EXISTR(SZ1,5,1);SS2:=BARSLAST(SZ2);C3:=SS2>=2 AND SS2<SS1 AND R2;C4:=SS2>=3 AND SS2<SS1 AND REF(C3,1)=0 AND R3;SZ3:=C3 OR C4 AND COUNT(C3 OR C4,SS2)=1 AND SS1<=9 AND EXISTR(SZ2,5,1);
{输出}{10日内普通异动}SU1:=YD1 AND COUNT(AMO>0,0)>5;SU2:=YD2 AND COUNT(AMO>0,0)>5;SU3:=YD3 AND CYB=0;SU4:=YD5 AND SHZB;SU5:=YD5 AND SZZB AND DATE<1230410;E0:=IF(SU1,'↖▲',IF(SU2,'↖2',IF(SU3,'↖3',IF(SU4 OR SU5,'↖5',''))));DRAWTEXT(GP AND PERIOD=5,0.992*L,E0),COLORB4B4B4;{10日内同向严重异动}ZU1:=YD4 AND INBLOCK('上证A股');ZU2:=YD4 AND SZZB AND DATE<1230410;ZU3:=SZZB4 AND DATE>=1230410;ZU:=ZU1 OR ZU2 OR ZU3;E1:=IF(ZU,'↖4','');DRAWTEXT(GP AND PERIOD=5,0.992*L,E1),COLORWHITE;{超出10日计数范围,重新计数}EU1:=YDX AND INBLOCK('上证A股');EU2:=SZ1 AND SZZB;EU3:=YDX AND SZZB AND DATE<1230410;EU4:=YDX2 AND INBLOCK('上证A股');EU5:=SZ2 AND SZZB;EU6:=YDX2 AND SZZB AND DATE<1230410;EU7:=YDX3 AND INBLOCK('上证A股');EU8:=SZ3 AND SZZB;EU9:=YDX3 AND SZZB AND DATE<1230410;E2:=IF(EU1 OR EU2 OR EU3,'↖▲',IF(EU4 OR EU5 OR EU6,'↖2',IF(EU7 OR EU8 OR EU9,'↖3','')));DRAWTEXT(GP AND PERIOD=5,0.992*L,E2),COLORB4B4B4;
{深证A股10日内存在严重异动,重新计数}FU1:=CY3;FU2:=SZZB1 AND DATE>=1230410;FU3:=CY4;FU4:=SZZB2 AND DATE>=1230410;FU5:=SZZB3 AND DATE>=1230410;E3:=IF(FU1 OR FU2,'↖▲',IF(FU3 OR FU4,'↖2',IF(FU5,'↖3','')));DRAWTEXT(GP AND PERIOD=5,0.992*L,E3),COLORB4B4B4;
{10个交易日内涨幅偏离值大于100%}PY1:=Y1 AND SHZB AND DATE>=1230417;PY2:=Y1 AND SZZB AND EXISTR(SZZB4,9,1)=0 AND DATE>=1230417;PY3:=Y1 AND KCB;PY4:=CY101 AND CYB;PY5:=CY102 AND CYB;PYX:=PY1 OR PY2 OR PY3 OR PY4 OR PY5;DRAWICON(GP AND PERIOD=5 AND PYX,L,1);{30个交易日内涨幅偏离值大于200%}PY6:=Y2 AND SHZB AND DATE>=1230524;PY7:=Y2 AND SZZB AND EXISTR(Y1,29,1)=0 AND DATE>=1230524;PY8:=Y2 AND KCB AND DATE>=1230101;PY9:=CY201 AND CYB AND DATE>=1230101;PY10:=CY202 AND CYB AND DATE>=1230101;PYZ:=PY6 OR PY7 OR PY8 OR PY9 OR PY10;DRAWICON(GP AND PERIOD=5 AND PYZ,L,38);
{异动预警}Z_1:=EXISTR(Y1,9,1)=0;{10日内不存在10天100%严重异动}Z_2:=EXISTR(Y2,9,1)=0;{10日内不存在30天200%严重异动}Z_3:=SZZB4 OR YD4 AND SHZB;{第4次异动}Z_4:=EXISTR(Z_3,9,0)=0;{10日内不存在同向严重异动}Z_5:=EXISTR(Y1,29,1)=0;{30日内不存在10天100%严重异动}Z_6:=EXISTR(Z_3,29,1)=0;{30日内不存在同向严重异动}
{连续10个交易日内涨幅偏离值>=100%严重异动预警}X_1:=(V1-P1)*100;{10个交易日内涨幅偏离值}X_2:=(2.0004+P1)*REF(C,W1);{10日偏离值严重异动触发时的价格}X_3:=(X_2/C-1)*100;{10日偏离值严重异动触发时的涨幅}
TJX:=ISLASTBAR AND GP AND PERIOD=5 AND FSCST=0;{仅对除北证及非双创ST外的股票日线周期生效}TJ01:=X_1>=60 AND EXISTR(Y1,9,0)=0 AND TJX AND SZZB=0;{10个交易日内涨幅偏离值>=70}{且尚未触发10日偏离值严重异动}{适用于非深证主板股票}TJ02:=X_1>=60 AND EXISTR(Y1,9,0)=0 AND TJX AND Z_2 AND Z_4 AND SZZB;{仅适用于深证主板}TJ0:=TJ01 OR TJ02;TJ1:=Y1 AND TJX;{10日偏离值严重异动触发当日}
{连续10个交易日内同向严重异动预警}X_9:=YD3 AND CYB=0;{第3次异动}X_91:=BARSLAST(X_9);X_10:=VALUEWHEN(X_9,SJ1);{第3次异动距离第一次异动的天数}X_11:=BARSLAST(X_9);{第3次异动距今的天数}
TJ21:=X_10<=7 AND SJ1<=9 AND X_91<SJ1 AND TJX AND Z_4 AND SHZB;{第三次异动当天距离第一次异动不超过7个交易日}{且第一次异动至今不超出9个交易日}{未触发第四次异动}{仅适用于上证主板}TJ22:=X_10<=7 AND SJ1<=9 AND X_91<SJ1 AND TJX AND Z_4 AND Z_1 AND Z_2 AND SZZB;{仅适用于深证主板}TJ2:=TJ21 OR TJ22;TJ3:=Z_3 AND TJX;{同向严重异动触发当日}
{10个交易日内涨幅偏离值、同向异动次数监控}DRAWTEXT_FIX(TJ0 OR TJ1 OR TJ2 OR TJ3,0.01,0.004,0,'.');DRAWTEXT_FIX(TJ0 OR TJ1 OR TJ2 OR TJ3,0.016,0.01,0,'连续'),COLORLIGRAY;DRAWTEXT_FIX(TJ0 OR TJ1 OR TJ2 OR TJ3,0.0375,0.01,0,'10个交易日'),RGBXFFC90E;DRAWTEXT_FIX(TJ0 OR TJ1 OR TJ2 OR TJ3,0.0913,0.01,0,'内:'),COLORLIGRAY;DRAWTEXT_FIX(TJ0 OR TJ1 OR TJ2 OR TJ3,0.107,0.01,0,'涨幅偏离值'),COLORFF00FF;DRAWTEXT_FIX(TJ0 OR TJ1 OR TJ2 OR TJ3,0.159,0.01,0,'累计'),COLORLIGRAY;DRAWNUMBER_FIX(TJ0 OR TJ1 OR TJ2 OR TJ3,0.182,0.01,0,X_1),COLORRED;HZ0:=IF(X_1<=99.9999,0.21,0.216);DRAWTEXT_FIX(TJ0 OR TJ1 OR TJ2 OR TJ3,HZ0,0.01,0,'%'),COLORRED;HZ1:=IF(X_1<=99.9999,0.223,0.229);DRAWTEXT_FIX(TJ2 OR TJ3,HZ1,0.01,0,','),COLORLIGRAY;HZ2:=IF(X_1<=99.9999,0.232,0.238);DRAWTEXT_FIX(TJ2 OR TJ3,HZ2,0.01,0,'同向异动'),RGBXFF7F27;HZ3:=IF(X_1<=99.9999,0.274,0.280);DRAWTEXT_FIX(TJ2 OR TJ3,HZ3,0.01,0,'共计'),COLORLIGRAY;HZ4:=IF(X_1<=99.9999,0.2962,0.3022);NU:=IF(Z_4,3,4);DRAWTEXT_FIX(TJ2 OR TJ3,HZ4,0.01,0,CON2STR(NU,0)),COLOR09C9E0;HZ5:=IF(X_1<=99.9999,0.303,0.309);DRAWTEXT_FIX(TJ2 OR TJ3,HZ5,0.01,0,'次 。'),COLORLIGRAY;
{10日内涨幅偏离值严重异动预警}DRAWTEXT_FIX(TJ0 OR TJ1,0.01,0.064,0,'.');DRAWTEXT_FIX(TJ0 OR TJ1,0.016,0.07,0,'偏离值'),COLORFF00FF;DRAWTEXT_FIX(TJ0 OR TJ1,0.048,0.07,0,'严重异动:');DRAWTEXT_FIX(TJ0,0.095,0.07,0,'当前股价上涨'),COLORLIGRAY;DRAWNUMBER_FIX(TJ0,0.16,0.07,0,X_3),COLORRED;WZ1:=IF(X_3<=9.99,0.181,0.187);DRAWTEXT_FIX(TJ0,WZ1,0.07,0,'%'),COLORRED;WZ2:=IF(X_3<=9.99,0.193,0.199);DRAWTEXT_FIX(TJ0,WZ2,0.07,0,'到达'),COLORLIGRAY;WZ3:=IF(X_3<=9.99,0.216,0.222);DRAWNUMBER_FIX(TJ0,WZ3,0.07,0,X_2),COLOR09C9E0;CZ0:=X_3<=9.99 AND X_2<=9.99;CZ1:=X_3>9.99 AND X_2>9.99;WZ4:=IF(CZ0,0.237,IF(CZ1,0.2492,0.2434));DRAWTEXT_FIX(TJ0,WZ4,0.07,0,'元'),COLOR09C9E0;WZ5:=IF(CZ0,0.25,IF(CZ1,0.2622,0.2562));DRAWTEXT_FIX(TJ0,WZ5,0.07,0,'后触发 。'),COLORLIGRAY;{触发后}DRAWTEXT_FIX(TJ1,0.095,0.07,0,'今日已于'),COLORLIGRAY;DRAWNUMBER_FIX(TJ1,0.1381,0.07,0,X_2),COLOR09C9E0;VZ1:=IF(X_2<=9.99,0.160,0.166);DRAWTEXT_FIX(TJ1,VZ1,0.07,0,'元'),COLOR09C9E0;VZ2:=IF(X_2<=9.99,0.173,0.179);DRAWTEXT_FIX(TJ1,VZ2,0.07,0,'处触发 !!'),COLORLIGRAY;
{连续10个交易日内第4次同向异动预警}P_X:=LLVBARS(C,X_11+1);P_0:=LLVBARS(C,4);P_1:=IF(X_11>=0 AND X_11<=3,P_X,P_0);P_2:=IF(SHZB,"999998$C"/REF("999998$C",P_1)-1,IF(CYB,"399102$C"/REF("399102$C",P_1)-1,IF(KCB,"SH000688$C"/REF("SH000688$C",P_1)-1,"399107$C"/REF("399107$C",P_1)-1)));{期间指数涨幅}P_3:=(1.2004+P_2)*REF(C,P_1);{第四次同向异动触发时的价格}P_4:=(P_3/C-1)*100;{第四次同向异动触发所需涨幅}{输出}R_3:=IF(TJ2 OR TJ3 AND TJ0=0 AND TJ1=0,0.064,0.123);{纵坐标}{10日同向异动次数处于预警阶段}{10日涨幅偏离值未进入预警或已触发}DRAWTEXT_FIX(TJ2 OR TJ3,0.01,R_3,0,'.');DRAWTEXT_FIX(TJ2 OR TJ3,0.016,R_3+0.006,0,'同向'),RGBXFF7F27;DRAWTEXT_FIX(TJ2 OR TJ3,0.038,R_3+0.006,0,'严重异动:');DRAWTEXT_FIX(TJ2,0.085,R_3+0.006,0,'当前股价上涨'),COLORLIGRAY;DRAWNUMBER_FIX(TJ2,0.15,R_3+0.006,0,P_4),COLORRED;PZ1:=IF(P_4<=9.99,0.1715,0.1775);DRAWTEXT_FIX(TJ2,PZ1,R_3+0.006,0,'%'),COLORRED;PZ2:=IF(P_4<=9.99,0.183,0.189);DRAWTEXT_FIX(TJ2,PZ2,R_3+0.006,0,'到达'),COLORLIGRAY;PZ3:=IF(P_4<=9.99,0.205,0.211);DRAWNUMBER_FIX(TJ2,PZ3,R_3+0.006,0,P_3),COLOR09C9E0;CZ2:=P_4<=9.99 AND P_3<=9.99;CZ3:=P_4>9.99 AND P_3>9.99;PZ4:=IF(CZ2,0.227,IF(CZ3,0.239,0.233));DRAWTEXT_FIX(TJ2,PZ4,R_3+0.006,0,'元'),COLOR09C9E0;PZ5:=IF(CZ2,0.239,IF(CZ3,0.252,0.246));DRAWTEXT_FIX(TJ2,PZ5,R_3+0.006,0,'后触发 。'),COLORLIGRAY;{触发后}DRAWTEXT_FIX(TJ3,0.085,R_3+0.006,0,'今日已于'),COLORLIGRAY;DRAWNUMBER_FIX(TJ3,0.128,R_3+0.006,0,P_3),COLOR09C9E0;XZ1:=IF(P_3<=9.99,0.150,0.156);DRAWTEXT_FIX(TJ3,XZ1,R_3+0.006,0,'元'),COLOR09C9E0;XZ2:=IF(P_3<=9.99,0.163,0.169);DRAWTEXT_FIX(TJ3,XZ2,R_3+0.006,0,'处触发 !!'),COLORLIGRAY;
{连续30个交易日内涨幅偏离值>=200%严重异动预警}X_5:=(V2-P2)*100;{30个交易日内涨幅偏离值}X_6:=(3.0005+P2)*REF(C,W2);{30日偏离值严重异动触发时的价格}X_7:=(X_6/C-1)*100;{现价距离触发30日偏离值严重异动所需的涨幅}TJ41:=X_5>=160 AND EXISTR(Y2,W2,0)=0 AND TJX AND SZZB=0;{30个交易日内涨幅偏离值>=160}{且尚未触发30日偏离值严重异动}{适用于非深证主板股票}TJ42:=X_5>=160 AND EXISTR(Y2,W2,0)=0 AND TJX AND Z_5 AND Z_6 AND SZZB;{仅适用于深证主板}TJ4:=TJ41 OR TJ42;TJ5:=Y2 AND TJX;{30日偏离值严重异动触发当日}{确定纵坐标}TJ6:=TJ4 OR TJ5 AND TJ0 OR TJ1 AND TJ2 OR TJ3;{10日、30日涨幅偏离值同时进入监控}TJ7:=TJ4 OR TJ5 AND TJ0=0 AND TJ1=0 AND TJ2=0 AND TJ3=0;{仅30日涨幅偏离值进入监控}TJ8:=TJ4 OR TJ5 AND TJ0=0 AND TJ1=0;{30日涨幅偏离值进入监控}{10日涨幅偏离值未进入预警或已触发}TJ9:=TJ4 OR TJ5 AND TJ2=0 AND TJ3=0;{30日涨幅偏离值进入监控}{10日同向异动次数未进入预警或已触发}R_0:=IF(TJ6,0.183,IF(TJ7,0.004,IF(TJ8 OR TJ9,0.123,DRAWNULL)));{纵坐标}R_1:=IF(TJ6,0.243,IF(TJ7,0.064,IF(TJ8 OR TJ9,0.183,DRAWNULL)));{输出}DRAWTEXT_FIX(TJ4 OR TJ5,0.01,R_0,0,'.');DRAWTEXT_FIX(TJ4 OR TJ5,0.016,R_0+0.006,0,'连续'),COLORLIGRAY;DRAWTEXT_FIX(TJ4 OR TJ5,0.0375,R_0+0.006,0,'30个交易日'),RGBXEE6BF0;DRAWTEXT_FIX(TJ4 OR TJ5,0.0913,R_0+0.006,0,'内:'),COLORLIGRAY;DRAWTEXT_FIX(TJ4 OR TJ5,0.107,R_0+0.006,0,'涨幅偏离值'),COLORLIRED;DRAWTEXT_FIX(TJ4 OR TJ5,0.159,R_0+0.006,0,'累计'),COLORLIGRAY;DRAWNUMBER_FIX(TJ4 OR TJ5,0.182,R_0+0.006,0,X_5),COLORRED;DRAWTEXT_FIX(TJ4 OR TJ5,0.216,R_0+0.006,0,'%'),COLORRED;{30日内涨幅偏离值严重异动预告}DRAWTEXT_FIX(TJ4 OR TJ5,0.01,R_1,0,'.');DRAWTEXT_FIX(TJ4 OR TJ5,0.016,R_1+0.006,0,'偏离值'),COLORLIRED;DRAWTEXT_FIX(TJ4 OR TJ5,0.048,R_1+0.006,0,'严重异动:');DRAWTEXT_FIX(TJ4,0.095,R_1+0.006,0,'当前股价上涨'),COLORLIGRAY;DRAWNUMBER_FIX(TJ4,0.16,R_1+0.006,0,X_7),COLORRED;QZ1:=IF(X_7<=9.99,0.182,0.188);DRAWTEXT_FIX(TJ4,QZ1,R_1+0.006,0,'%'),COLORRED;QZ2:=IF(X_7<=9.99,0.193,0.199);DRAWTEXT_FIX(TJ4,QZ2,R_1+0.006,0,'到达'),COLORLIGRAY;QZ3:=IF(X_7<=9.99,0.216,0.222);DRAWNUMBER_FIX(TJ4,QZ3,R_1+0.006,0,X_6),COLOR09C9E0;RZ0:=X_6<=9.99 AND X_7<=9.99;RZ1:=X_6>9.99 AND X_7>9.99;QZ4:=IF(RZ0,0.237,IF(RZ1,0.2492,0.2432));DRAWTEXT_FIX(TJ4,QZ4,R_1+0.006,0,'元'),COLOR09C9E0;QZ5:=IF(RZ0,0.25,IF(RZ1,0.262,0.256));DRAWTEXT_FIX(TJ4,QZ5,R_1+0.006,0,'后触发 。'),COLORLIGRAY;{触发后}DRAWTEXT_FIX(TJ5,0.085,R_1,0,'今日已于'),COLORLIGRAY;DRAWNUMBER_FIX(TJ5,0.128,R_1+0.006,0,X_6),COLOR09C9E0;FZ1:=IF(X_6<=9.99,0.150,0.156);DRAWTEXT_FIX(TJ5,FZ1,R_1+0.006,0,'元'),COLOR09C9E0;FZ2:=IF(X_6<=9.99,0.163,0.169);DRAWTEXT_FIX(TJ5,FZ2,R_1+0.006,0,'处触发 !!'),COLORLIGRAY;
{交易监管}YZYD:=FILTER(ZU1 OR ZU3 OR PYX OR PYZ,29);JJTS:=VALUEWHEN(YZYD,DAYSTOTODAY);JYJG:=JJTS>0 AND JJTS<=15 AND GP AND ISLASTBAR;DRAWTEXT_FIX(JYJG,0.99,0.95,1,'<):该股目前处于交易监管期 !'),COLORB5B5B5;
{盘中触发严重异动,但收盘未触发}VN01:=H>=X_2 AND C<X_2 AND EXISTR(Y1,9,0)=0 AND INBLOCK('上证A股');VN02:=H>=X_2 AND C<X_2 AND EXISTR(Y1,9,0)=0 AND EXISTR(Y2,9,0)=0 AND EXISTR(YD4 OR SZZB4,9,0)=0 AND INBLOCK('深证A股');VN0:=VN01 OR VN02;VN11:=H>=P_3 AND C<P_3 AND SJ1<=9 AND SJ3<SJ1 AND SJ3>=2 AND EXISTR(YD4 OR SZZB4,9,0)=0 AND INBLOCK('上证A股');VN12:=H>=P_3 AND C<P_3 AND SJ1<=9 AND SJ3<SJ1 AND SJ3>=2 AND EXISTR(YD4 OR SZZB4,9,0)=0 AND EXISTR(Y2,9,0)=0 AND EXISTR(Y1,9,0)=0 AND INBLOCK('深证A股');VN1:=VN11 OR VN12;VN21:=H>=X_6 AND C<X_6 AND EXISTR(Y2,29,0)=0 AND INBLOCK('上证A股');VN22:=H>=X_6 AND C<X_6 AND EXISTR(Y2,29,0)=0 AND EXISTR(Y1,29,0)=0 AND EXISTR(YD4 OR SZZB4,29,0)=0 AND INBLOCK('深证A股');VN2:=VN21 OR VN22;XYX:=IF(C>O AND O/L-1<0.02,L-0.2,IF(C<O AND C/L-1<0.02,L-0.3,IF(C>O AND O/L-1>0.02,L-0.1,IF(C<O AND C/L-1>0.02,L-0.1,0))));DRAWTEXT(VN0 AND PERIOD=5 AND GP,XYX,'★'),COLORMAGENTA;{盘中触发10天100%}{洋红色星}DRAWTEXT(VN1 AND PERIOD=5 AND GP,XYX,'★'),RGBXFF7F27;{盘中触发10天第4次同向}{橙色星}DRAWTEXT(VN2 AND PERIOD=5 AND GP,XYX,'★'),COLORLIRED;{盘中触发30天200%}{淡红色星};