代写指标:通达信异动及严重异动主图2.0以及相关设置 源码分享 附图

TEN:=70;
THIRTY:=120;
{涨停与炸板}
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>=1220713,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));{个股三日异动}

{10个交易日内的连续同向异动统计}
YD:=R2 OR R3;
YD1:=YD AND EXISTR(YD,5,1)=0 AND COUNT(AMO>0,0)>5;{前5日内无异动,且上市天数大于5}{10日内第1次异动}
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:=LLVBARS(C,11);{11个交易日内最低收盘价距今周期数}
W2:=LLVBARS(C,31);{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);
{输出}
{全市场适用}
DRAWTEXT(GP AND PERIOD=5 AND YD1 AND COUNT(AMO>0,0)>5,0.992*L,'↖▲'),COLORB4B4B4;
DRAWTEXT(GP AND PERIOD=5 AND YD2 AND COUNT(AMO>0,0)>5,0.992*L,'↖2'),COLORB4B4B4;
{上证A股连续异动}
DRAWTEXT(GP AND PERIOD=5 AND YD3 AND CYB=0,0.992*L,'↖3'),COLORB4B4B4;
DRAWTEXT(GP AND PERIOD=5 AND YD4 AND INBLOCK('上证A股'),0.992*L,'↖4'),COLORWHITE;
DRAWTEXT(GP AND PERIOD=5 AND YD5 AND SHZB,0.992*L,'↖5'),COLORLIGRAY;
DRAWTEXT(GP AND PERIOD=5 AND YDX AND INBLOCK('上证A股'),0.992*L,'↖▲'),COLORB4B4B4;
DRAWTEXT(GP AND PERIOD=5 AND YDX2 AND INBLOCK('上证A股'),0.992*L,'↖2'),COLORB4B4B4;
DRAWTEXT(GP AND PERIOD=5 AND YDX3 AND INBLOCK('上证A股'),0.992*L,'↖3'),COLORB4B4B4;
{深证A股连续异动}
DRAWTEXT(GP AND PERIOD=5 AND CY3,0.992*L,'↖▲'),COLORB4B4B4;
DRAWTEXT(GP AND PERIOD=5 AND CY4,0.992*L,'↖2'),COLORB4B4B4;
DRAWTEXT(GP AND PERIOD=5 AND YD4 AND SZZB AND DATE<1230410,0.992*L,'↖4'),COLORB4B4B4;
DRAWTEXT(GP AND PERIOD=5 AND YD5 AND SZZB AND DATE<1230410,0.992*L,'↖5'),COLORB4B4B4;
DRAWTEXT(GP AND PERIOD=5 AND YDX AND SZZB AND DATE<1230410,0.992*L,'↖▲'),COLORB4B4B4;
DRAWTEXT(GP AND PERIOD=5 AND YDX2 AND SZZB AND DATE<1230410,0.992*L,'↖2'),COLORB4B4B4;
DRAWTEXT(GP AND PERIOD=5 AND YDX3 AND SZZB AND DATE<1230410,0.992*L,'↖3'),COLORB4B4B4;
DRAWTEXT(GP AND PERIOD=5 AND SZZB4 AND DATE>=1230410,0.992*L,'↖4'),COLORWHITE;
DRAWTEXT(GP AND PERIOD=5 AND SZZB1 AND DATE>=1230410,0.992*L,'↖▲'),COLORB4B4B4;
DRAWTEXT(GP AND PERIOD=5 AND SZZB2 AND DATE>=1230410,0.992*L,'↖2'),COLORB4B4B4;
DRAWTEXT(GP AND PERIOD=5 AND SZZB3 AND DATE>=1230410,0.992*L,'↖3'),COLORB4B4B4;
DRAWTEXT(GP AND PERIOD=5 AND SZ1 AND SZZB,0.992*L,'↖▲'),COLORB4B4B4;
DRAWTEXT(GP AND PERIOD=5 AND SZ2 AND SZZB,0.992*L,'↖2'),COLORB4B4B4;
DRAWTEXT(GP AND PERIOD=5 AND SZ3 AND SZZB,0.992*L,'↖3'),COLORB4B4B4;
{10个交易日内涨幅偏离值大于100%,30个交易日内涨幅偏离值大于200%}
DRAWICON(GP AND PERIOD=5 AND Y1 AND SHZB AND DATE>=1230417,L,1);
DRAWICON(GP AND PERIOD=5 AND Y2 AND SHZB AND DATE>=1230524,L,38);
DRAWICON(GP AND PERIOD=5 AND Y1 AND KCB,L,1);
DRAWICON(GP AND PERIOD=5 AND Y2 AND KCB AND DATE>=1230101,L,38);
DRAWICON(GP AND PERIOD=5 AND CY101 AND CYB,L,1);
DRAWICON(GP AND PERIOD=5 AND CY102 AND CYB,L,1);
DRAWICON(GP AND PERIOD=5 AND CY201 AND CYB AND DATE>=1230101,L,38);
DRAWICON(GP AND PERIOD=5 AND CY202 AND CYB AND DATE>=1230101,L,38);
DRAWICON(GP AND PERIOD=5 AND Y1 AND SZZB AND EXISTR(YD4,9,1)=0 AND DATE>=1230417,L,1);
DRAWICON(GP AND PERIOD=5 AND Y2 AND SZZB AND EXISTR(Y1,29,1)=0 AND DATE>=1230524,L,38);


Z_1:=EXISTR(Y1,W1,0)=0;{10日内不存在10天100%严重异动}
Z_2:=EXISTR(Y2,W1,1)=0;{10日内不存在30天200%严重异动}
Z_3:=SZZB4 OR YD4 AND SHZB;{第4次异动}
Z_4:=EXISTR(Z_3,W1,1)=0;{10日内不存在同向严重异动}
Z_5:=EXISTR(Y1,W2,1)=0;{30日内不存在10天100%严重异动}
Z_6:=EXISTR(Z_3,W2,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>=TEN AND EXISTR(Y1,W1,0)=0 AND TJX AND SZZB=0;{10个交易日内涨幅偏离值>=70}{且尚未触发10日偏离值严重异动}{适用于非深证主板股票}
TJ02:=X_1>=TEN AND EXISTR(Y1,W1,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_10:=VALUEWHEN(X_9,SJ1);{第3次异动距离第一次异动的天数}
X_11:=BARSLAST(X_9);{第3次异动距今的天数}

TJ21:=X_10<=7 AND SJ1<=9 AND X_1>=70 AND TJX AND Z_4 AND SHZB;{第三次异动当天距离第一次异动不超过7个交易日}{且第一次异动至今不超出9个交易日}{未触发第四次异动}{仅适用于上证主板}
TJ22:=X_10<=7 AND SJ1<=9 AND X_1>=70 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);
DRAWNUMBER_FIX(TJ2 OR TJ3,HZ4,0.01,0,NU),COLOR09C9E0;
HZ5:=IF(X_1<=99.9999,0.319,0.325);
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.182,0.188);
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.249,0.2432));
DRAWTEXT_FIX(TJ0,WZ4,0.07,0,'元'),COLOR09C9E0;
WZ5:=IF(CZ0,0.25,IF(CZ1,0.262,0.256));
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个交易日内涨幅偏离值监控}
{连续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>=THIRTY AND EXISTR(Y2,W2,0)=0 AND TJX AND SZZB=0;{30个交易日内涨幅偏离值>=THIRTY}{且尚未触发30日偏离值严重异动}{适用于非深证主板股票}
TJ42:=X_5>=THIRTY 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;
{交易监管}
JYJG:=INBLOCK('MY.交易监管') AND ISLASTBAR AND GP;
DRAWTEXT_FIX(JYJG,0.99,0.95,1,'<):该股目前处于交易监管期 !'),COLORB5B5B5;


来函数检测结果如下:
该公式没有未来函数

解密、编写股票、期货策略请联系QQ或微信同号:88652583
相关股票指标公式

联系我们  |  股票指标网  |  指标网   |  指标公式  |   加入收藏   |  设为主页

@2005-2023 粤ICP备2023063687号-2 股票指标网别名指标网仅为互联网文章,所有股票指标公式及文章仅供学习研究,并不构成投资建议,请勿以此为依据进行股票交易,由此引起的投资亏损与本站无关。股票指标网均来源互联网收集整理,如不慎侵犯了你的权益,请联系我们告知,我们将做删除处理
QQ:88652583 微信 88652583
sitemap站点地图