通达信呆呆兔主图、MACD定量结构、振幅副、倍量副图 套装指标 源码 附图
{MACD定量结构副图源码如下图源码如下}
获利比例:WINNER(CLOSE)*100,NODRAW,COLORYELLOW;
筹码集中度:(COST(95)-COST(5))/(COST(95)+COST(5))*100,NODRAW;DIF:MACD.DIF,COLORLIGRAY;
DEA:MACD.DEA,COLORYELLOW;
强度:IF(DIF>DEA,DIF,DRAWNULL),COLORRED;
强度1:IF(DEA<DIF,DEA,DRAWNULL),COLORMAGENTA;
{}
MACD:(DIF-DEA)*2,COLORSTICK;
MACD2:=MACD;
MJ:=MACD;
S05:=SUM(MJ,0);
QST:=BARSLAST(MJ<0 AND REF(MJ,1)>0)+1;
QXT:=BARSLAST(MJ>0 AND REF(MJ,1)<0)+1;
S5:=IF(MJ>0,S05-REF(S05,BARSLAST(MJ<0)),S05-REF(S05,BARSLAST(MJ>0)))/10;
ST:=IF(MJ>0,REF(QST,QXT)+QXT,REF(QXT,QST)+QST);
RS5:=REF(S5,ST);
低位金叉:=CROSS(DIF,DEA) AND DIF<-0.1;
JCCOUNT:=COUNT(CROSS(DIF,DEA),BARSLAST(DEA>=0));
二次金叉:=CROSS(DIF,DEA) AND DEA<0 AND COUNT(JCCOUNT=2,21)=1;
DRAWICON(二次金叉,0,25);
三次金叉:=CROSS(DIF,DEA) AND DEA<0 AND COUNT(JCCOUNT=3,60)=1;
DRAWICON(三次金叉,0,26);
A002:=BARSLAST(REF(CROSS(DIF,DEA),1));
底背离:=REF(CLOSE,A002+1)>CLOSE AND DIF>REF(DIF,A002+1) AND CROSS(DIF,DEA);
DRAWICON(LONGCROSS(CLOSE,MA(CLOSE,5),17),MACD2,1);
DRAWTEXT(二次金叉>低位金叉,DIF,'金2'),COLORRED;
{RSI买卖点-不需要的可以屏蔽}
C81:=REF(C,1);
RN:=9;
RSI1:=SMA(MAX(C-C81,0),RN,1)/SMA(ABS(C-C81),RN,1)*100;
低点:=CROSS(RSI1,20);
STICKLINE(低点,0.1,0,0.3,0),COLORYELLOW;
DRAWICON(低点, 0.15,1);
DRAWTEXT(低点, 0.14,'←底'),COLORYELLOW;
顶:=CROSS(80,RSI1);
DRAWICON(顶, DIF*1.15,2);
DRAWTEXT(顶, DIF*1.1,'←减/清仓'),COLORGREEN;
{定量结构}
{底部结构预警}
死叉:=CROSS(DEA,DIF);
N1:=BARSLAST(死叉),NODRAW;{最近一次死叉的位置}
N2:=REF(BARSLAST(死叉),N1+1),NODRAW;{倒数第二次死叉与倒数第一次死叉的区间}
N3:=REF(BARSLAST(死叉),N2+N1+2),NODRAW;{倒数第三次死叉与倒数第二次死叉的区间}
CL1:=LLV(C,N1+1),NODRAW;{最近一次死叉后,最低收盘价}
DIFL1:=LLV(DIF,N1+1),NODRAW;
CL2:=REF(CL1,N1+1),NODRAW;{倒数第二次死叉与倒数第一次死叉之间的最低收盘价}
DIFL2:=REF(DIFL1,N1+1),NODRAW;
CL3:=REF(CL2,N1+1),NODRAW;{倒数第三次死叉与倒数第二次死叉之间的最低收盘价}
DIFL3:=REF(DIFL2,N1+1),NODRAW;
PDIFL2:=IF(DIFL2>0,INTPART(LOG(DIFL2))-1,INTPART(LOG(-DIFL2))-1);
MDIFL2:=INTPART(DIFL2/POW(10,PDIFL2));
PDIFL3:=IF(DIFL3>0,INTPART(LOG(DIFL3))-1,INTPART(LOG(-DIFL3))-1);
MDIFL3:=INTPART(DIFL3/POW(10,PDIFL3));
MDIFB2:=INTPART(DIF/POW(10,PDIFL2));
MDIFB3:=INTPART(DIF/POW(10,PDIFL3));
直接底背离:=(CL1<CL2 ) AND (MDIFB2>MDIFL2) AND (MACD<0 AND REF(MACD,1)<0) AND MDIFB2<=REF(MDIFB2,1);
隔峰底背离:=(CL1<CL3 AND CL3<CL2 ) AND (MDIFB3>MDIFL3) AND (MACD<0 AND REF(MACD,1)<0) AND MDIFB3<=REF(MDIFB3,1);
B6:直接底背离 OR 隔峰底背离,NODRAW;
BG:((MDIFB2>REF(MDIFB2,1))*REF(直接底背离,1)) OR ((MDIFB3>REF(MDIFB3,1))*REF(隔峰底背离,1)),NODRAW;
底背离消失:=(REF(直接底背离,1) AND DIFL1<=DIFL2 ) OR (REF(隔峰底背离,1) AND DIFL1<=DIFL3);
DRAWTEXT(TFILTER(B6,MACD>0,1),(DIF+MACD),'钝化'),COLORRED;
STICKLINE(B6 OR BG,DIF,DEA,1,-1),COLORRED;
DRAWTEXT(TFILTER(底背离消失,B6,1),(DIF+MACD),'消失'),COLORYELLOW;
DRAWTEXT(TFILTER(BG,MACD>0,1),DIF*1.1,'M底背'),COLORMAGENTA;
{顶部结构预警}
金叉:=CROSS(DIF,DEA);
M1:=BARSLAST(金叉),NODRAW;{最近一次金叉的位置}
M2:=REF(BARSLAST(金叉),M1+1),NODRAW;{倒数第二次金叉与倒数第一次金叉的区间}
M3:=REF(BARSLAST(金叉),M2+M1+2),NODRAW;{倒数第三次金叉与倒数第二次金叉的区间}
CH1:=HHV(C,M1+1),NODRAW;{最近一次金叉后,最高收盘价}
DIFH1:=HHV(DIF,M1+1),NODRAW;
CH2:=REF(CH1,M1+1),NODRAW;{倒数第二次金叉与倒数第一次金叉之间的最高收盘价}
DIFH2:=REF(DIFH1,M1+1),NODRAW;
CH3:=REF(CH2,M1+1),NODRAW;{倒数第三次金叉与倒数第二次金叉之间的最高收盘价}
DIFH3:=REF(DIFH2,M1+1),NODRAW;
PDIFH2:=IF(DIFH2>0,INTPART(LOG(DIFH2))-1,INTPART(LOG(-DIFH2))-1);
MDIFH2:=INTPART(DIFH2/POW(10,PDIFH2));
PDIFH3:=IF(DIFH3>0,INTPART(LOG(DIFH3))-1,INTPART(LOG(-DIFH3))-1);
MDIFH3:=INTPART(DIFH3/POW(10,PDIFH3));
MDIFT2:=INTPART(DIF/POW(10,PDIFH2));
MDIFT3:=INTPART(DIF/POW(10,PDIFH3));
直接顶背离:=(CH1>CH2 ) AND (MDIFT2<MDIFH2) AND (MACD>0 AND REF(MACD,1)>0) AND MDIFT2>=REF(MDIFT2,1);
隔峰顶背离:=(CH1>CH3 AND CH3>CH2 ) AND (MDIFT3<MDIFH3) AND (MACD>0 AND REF(MACD,1)>0) AND MDIFT3>=REF(MDIFT3,1);
T6:直接顶背离 OR 隔峰顶背离,NODRAW;
TG:((MDIFT2<REF(MDIFT2,1))*REF(直接顶背离,1)) OR ((MDIFT3<REF(MDIFT3,1))*REF(隔峰顶背离,1)),NODRAW;
顶背离消失:=(REF(直接顶背离,1) AND DIFH1>=DIFH2 ) OR (REF(隔峰顶背离,1) AND DIFH1>=DIFH3);
DRAWTEXT(TFILTER(T6,MACD<0,1),(DIF+MACD),'钝化'),COLORGREEN;
DRAWTEXT(TFILTER(顶背离消失,T6,1),(DIF+MACD),'消失'),COLORYELLOW;
STICKLINE(T6 OR TG,DIF,DEA,1,-1),COLORLIGREEN;
DRAWTEXT(TFILTER(TG,MACD<0,1),DIF*1.02,'M顶背'),COLORMAGENTA;
{}
{};
TRR := SUM(MAX(MAX(HIGH-LOW,ABS(HIGH-REF(CLOSE,1))),ABS(LOW-REF(CLOSE,1))),14);
HD := HIGH-REF(HIGH,1);
LD := REF(LOW,1)-LOW;
PDM:= SUM(IF(HD>0 AND HD>LD,HD,0),14);
MDM:= SUM(IF(LD>0 AND LD>HD,LD,0),14);
PDI:= PDM*100/TRR;
MDI:= MDM*100/TRR;
A1:=BARSLAST(REF(CROSS("MACD.DIF"(12,26,9),"MACD.DEA"(12,26,9)),1));
B1:=REF(C,A1+1)>C AND REF("MACD.DIF"(12,26,9),A1+1)<"MACD.DIF"(12,26,9) AND CROSS("MACD.DIF"(12,26,9),"MACD.DEA"(12,26,9));
A2:=BARSLAST(REF(CROSS("KDJ.K"(9,3,3),"KDJ.D"(9,3,3)),1));
B2:=REF(C,A2+1)>C AND REF("KDJ.K"(9,3,3),A2+1)<"KDJ.K"(9,3,3) AND CROSS("KDJ.K"(9,3,3),"KDJ.D"(9,3,3));
A3:=BARSLAST(REF(CROSS("RSI.RSI1"(6,12,24),"RSI.RSI2"(6,12,24)),1));
B3:=REF(C,A3+1)>C AND REF("RSI.RSI1"(6,12,24),A3+1)<"RSI.RSI1"(6,12,24) AND CROSS("RSI.RSI1"(6,12,24),"RSI.RSI2"(6,12,24));
C1:=BARSLAST(REF(CROSS("MACD.DEA"(12,26,9),"MACD.DIF"(12,26,9)),1));
D1:=REF(C,C1+1)<C AND REF("MACD.DIF"(12,26,9),C1+1)>"MACD.DIF"(12,26,9) AND CROSS("MACD.DEA"(12,26,9),"MACD.DIF"(12,26,9));
C2:=BARSLAST(REF(CROSS("KDJ.D"(9,3,3),"KDJ.K"(9,3,3)),1));
D2:=REF(C,C2+1)<C AND REF("KDJ.K"(9,3,3),C2+1)>"KDJ.K"(9,3,3) AND CROSS("KDJ.D"(9,3,3),"KDJ.K"(9,3,3));
C3:=BARSLAST(REF(CROSS("RSI.RSI2"(6,12,24),"RSI.RSI1"(6,12,24)),1));
D3:=REF(C,C3+1)<C AND REF("RSI.RSI1",C3+1)>"RSI.RSI1"
AND CROSS("RSI.RSI2","RSI.RSI1");
DRAWTEXT(B2>0,DIF*1.2,'K底'),COLORFF00FF;
DRAWTEXT(D2>0,DIF*1.2,'K顶'),COLORFFCC66;
DRAWTEXT(B3>0,DIF*1,'R底'),COLORYELLOW;
DRAWTEXT(D3>0,DIF*1,'R顶'),COLORFFFFFF;
{卧底藏龙}{副图}{选股}
TDJ1:=(H-L)/REF(C,1)>0.05;
YUL1:=COUNT(TDJ1,5)>1;
TU1:=CLOSE/MA(C,40)<0.74;
启动1:=TDJ1 AND YUL1 AND TU1;
ZC:=REF(CLOSE,1);
VAR1:=SMA(MAX(CLOSE-ZC,0),7,1)/SMA(ABS(CLOSE-ZC),7,1)*100;
VAR2:=((MA(C,30)-LOW)/MA(C,60))*200;
GL1:=FILTER(REF(VAR1,1)<20 AND VAR1>REF(VAR1,1),5);
波段1:=FILTER(GL1 AND REF(启动1,1) AND VAR2>20 AND C>REF(C,1),10);
MA5:=EMA(C,5);
EM5:=EMA(MA5,5);
VAR3:=ABS(MA5-EM5);
VAR4:=MA5-REF(MA5,1);
VAR5:=VAR4-REF(VAR4,1);
VAR6:=(VAR4+VAR5)/2;
TDF1:=POW(VAR3,1)*POW(VAR6,3);
NTDF1:=TDF1/HHV(ABS(TDF1),15);
确定1:=波段1 AND CROSS(NTDF1,-0.05);
选股1:=FILTER(REF(启动1,1) AND (确定1 OR C>REF(C,1)) AND "MACD.MACD"(12,26,9)>-1.5,10);
卧底1:(COUNT(选股1,13)>=1 AND (波段1 OR 确定1))*0.4,COLORRED;
DRAWTEXT(卧底1=0.4,0.3,'←卧底'),COLORRED;
{倍量副图源码如下}
TOTAL:=IF(PERIOD=1,5,IF(PERIOD=2,15,IF(PERIOD=3,30,IF(PERIOD=4,60,IF(PERIOD=5,TOTALFZNUM,1)))));
MTIME:=MOD(FROMOPEN,TOTAL);
CTIME:=IF(MTIME<0.5,TOTAL,MTIME);
{倍量柱}
VVOL:IF(CURRBARSCOUNT=1 AND PERIOD=5,VOL*240/FROMOPEN,DRAWNULL),NODRAW;
STICKLINE(CURRBARSCOUNT=1 AND PERIOD=5,VVOL,0,-1,-1),COLOR00C0C0;
VOLUME:VOL,VOLSTICK;
AA:=VOL>REF(V,1)*1.9;{倍量}
{AA1:=VOL<REF(LLV(VOL,13),1);}
AA1:=V/REF(V,1)<=0.6;{缩倍量}
STICKLINE(AA,0,V,2,0),COLORYELLOW;
STICKLINE(AA1,0,V,2,0),COLOR1D7300;
MV5:MA(V,5)COLORYELLOW;
MV35:MA(V,35)COLORMAGENTA;{启动}
MV135:MA(V,135)COLOR1D7300;{异动}
DRAWICON(CROSS(MV5,MV135),MV5,1); {5日上穿135日做记号};
{振幅副图源码如下}
振幅:((H-L)/REF(C,1))*100,COLORRED,NODRAW;
振幅2:STICKLINE(振幅<2,0,振幅,2,0)COLORBLUE;
振幅2至3:STICKLINE(3>振幅 AND 振幅>=2,0,振幅,2,0)COLORBLUE;
STICKLINE(3>振幅 AND 振幅>=2,0,2,2,0)COLORBLUE;
振幅3至5:STICKLINE(5>振幅 AND 振幅>=3,0,振幅,2,0)COLORYELLOW;
STICKLINE(5>振幅 AND 振幅>=3,2,3,2,0)COLORBLUE;
STICKLINE(5>振幅 AND 振幅>=3,0,2,2,0)COLORBLUE;
振幅5至10:STICKLINE(10>振幅 AND 振幅>=5,0,振幅,2,0)COLORMAGENTA;
STICKLINE(10>振幅 AND 振幅>=5,3,5,2,0)COLORYELLOW;
STICKLINE(10>振幅 AND 振幅>=5,2,3,2,0)COLORBLUE;
STICKLINE(10>振幅 AND 振幅>=5,0,2,2,0)COLORBLUE;
振幅大于10:STICKLINE(振幅>=10,0,振幅,2,0)COLOR0000FF;
STICKLINE(振幅>=10,5,10,2,0)COLORMAGENTA;
STICKLINE(振幅>=10,3,5,2,0)COLORYELLOW;
STICKLINE(振幅>=10,2,3,2,0)COLORBLUE;
STICKLINE(振幅>=10,0,2,2,0)COLORBLUE;
3;5;10;
{呆呆兔主图源码如下}
分时均价:AMOUNT/VOL/100,NODRAW,COLORYELLOW;
{变色加粗BBI}
BBI:(MA(CLOSE,3)+MA(CLOSE,6)+MA(CLOSE,12)+MA(CLOSE,24))/4,LINETHICK2;
IF(C>=BBI,BBI,DRAWNULL),COLORRED,LINETHICK2;
IF(C<BBI,BBI,DRAWNULL),COLORGREEN,LINETHICK2;
{近日最高最低价画线}
近日高:IF(CURRBARSCOUNT<=CONST(FINDHIGHBARS(HIGH,0,6,1)+1),CONST(FINDHIGH(HIGH,0,6,1)),DRAWNULL),COLORRED,LINETHICK1;
近日低:IF(CURRBARSCOUNT<=CONST(FINDLOWBARS(LOW,0,6,1)+1),CONST(FINDLOW(LOW,0,6,1)),DRAWNULL),COLORGREEN,LINETHICK1;
DRAWSL(ISLASTBAR,近日高,0,2000,1),COLORRED,LINETHICK1;
DRAWSL(ISLASTBAR,近日低,0,2000,1),COLORGREEN,LINETHICK1;
{涨跌停K线变色}
RQ:=IF(DATE>=1200824,1,0);
KCB:=IF(INBLOCK('科创板'),1,0);
CYB:=IF(INBLOCK('创业板') AND RQ,1,0);
{20%涨停洋红色,跌停蓝色}
STICKLINE(C/REF(C,1)>1.195 AND C=H AND (KCB OR CYB) AND PERIOD=5,O,C,3,0),COLORMAGENTA;
STICKLINE(C/REF(C,1)<0.805 AND C=L AND (KCB OR CYB) AND PERIOD=5,O,C,3,0),COLORBLUE;
{10%涨停红色,跌停绿色}
STICKLINE(C/REF(C,1)>1.095 AND C=H AND NOT(KCB OR CYB) AND PERIOD=5,O,C,3,0),COLORRED;
STICKLINE(C/REF(C,1)<0.905 AND C=L AND NOT(KCB OR CYB) AND PERIOD=5,O,C,3,0),COLORGREEN;
{自定义数据}
DRAWTEXT_FIX(1,0.00,0.00,0,'主营业务:')COLOR0000FF;
DRAWTEXT_FIX(1,0.05,0.00,0,EXTERNSTR(0,1))COLOR0000FF;
DRAWTEXT_FIX(1,0.00,0.07,0,'所属概念:')COLORFF00FF;
DRAWTEXT_FIX(1,0.05,0.07,0,EXTERNSTR(0,2))COLORFF00FF;
DRAWTEXT_FIX(1,0.00,0.14,0,'')COLOR00FF00;
DRAWTEXT_FIX(1,0.00,0.14,0,EXTERNSTR(0,3))COLOR00FF00;
DRAWTEXT_FIX(1,0.00,0.21,0,'解禁信息:')COLORYELLOW;
DRAWTEXT_FIX(1,0.05,0.21,0,EXTERNSTR(0,4))COLORYELLOW;
DRAWTEXT_FIX(1,0.00,0.28,0,'减持信息:')COLORYELLOW;
DRAWTEXT_FIX(1,0.05,0.28,0,EXTERNSTR(0,5))COLORYELLOW;
{周标记}
JZX:=WEEKDAY<>REF(WEEKDAY,1);{时间取值取周}
DRAWNUMBER(JZX,L,WEEKDAY)COLORYELLOW;
未来函数检测结果如下:
该公式包含未来函数:WINNER
该公式包含未来函数:COST
该公式包含未来函数:DHIGH
该公式包含未来函数:DLOW
解密、定制、编写股票指标请联系QQ或微信同号:88652583
相关股票指标公式
输出{MACD定量结构副图源码如下图源码如下}获利比例:收盘价计算的获利盘比例*100,NODRAW,画黄色
输出筹码集中度:(获利盘为95%的成本分布-COST(5))/(获利盘为95%的成本分布+COST(5))*100,NODRAW
输出DIF:MACD.DIF,COLORLIGRAY
输出DEA:MACD.DEA,画黄色
如果D>DEA返回DIF否则返回DRAWNULL
如果DEA 输出{}MACD:(DIF-DEA)*2,COLORSTICK
MACD2赋值:MACD
MJ赋值:MACD
S05赋值:0的MJ日累和
QST赋值:上次MJ<0 AND 1日前的MJ>0距今天数+1
QXT赋值:上次MJ>0 AND 1日前的MJ<0距今天数+1
S5赋值:IF(MJ>0,S05-REF(S05,上次MJ<0距今天数),S05-REF(S05,BARSLAST(MJ>0)))/10
ST赋值:IF(MJ>0,QXT日前的QST+QXT,QST日前的QXT+QST)
RS5赋值:ST日前的S5
低位金叉赋值:DIF上穿DEA AND DIF<-0.1
JCCOUNT赋值:COUNT(DIF上穿DEA,上次DEA>=0距今天数)
二次金叉赋值:DIF上穿DEA AND DEA<0 AND 统计21日满足JC=2的天数=1
当满足条件二次金叉时,在0和25之间画图标
三次金叉赋值:DIF上穿DEA AND DEA<0 AND 统计60日满足JC=3的天数=1
当满足条件三次金叉时,在0和26之间画图标
A002赋值:上次1日前的DIF上穿DEA距今天数
底背离赋值:A002+1日前的收盘价>收盘价 AND DIF>A002+1日前的DIF AND DIF上穿DEA
DRAWICON(LONGCROSS(收盘价,收盘价的5日简单移动平均,17),MACD2,1)
当满足条件二次金叉>低位金叉时,在DIF和'金2'位置书写文字
{RSI买卖点-不需要的可以屏蔽}C81赋值:1日前的C
RN赋值:9
RSI1赋值:SMA(C-C81和0较大值,RN,1)/SMA(C-C81的绝对值,RN,1)*100
低点赋值:RSI1上穿20
当满足条件低点时,在0.1和0之间画柱状线
当满足条件低点时,在 0.15和1之间画图标
当满足条件低点时,在 0.14和'←底'位置书写文字
顶赋值:80上穿RSI1
当满足条件顶时,在 DIF*1.15和2之间画图标
当满足条件顶时,在 DIF*1.1和'←减/清仓'位置书写文字
{定量结构}{底部结构预警}死叉赋值:DEA上穿DIF
N1赋值:上次死叉距今天数,NODRAW
{最近一次死叉的位置}N2赋值:REF(上次死叉距今天数,N1+1),NODRAW
{倒数第二次死叉与倒数第一次死叉的区间}N3赋值:REF(上次死叉距今天数,N2+N1+2),NODRAW
{倒数第三次死叉与倒数第二次死叉的区间}CL1赋值:N1+1日内C最低值,NODRAW
{最近一次死叉后,最低收盘价}DIFL1:=N1+1日内DIF最低值,NODRAW
CL2赋值:N1+1日前的CL1,NODRAW
{倒数第二次死叉与倒数第一次死叉之间的最低收盘价}DIFL2:=N1+1日前的DIFL1,NODRAW
CL3赋值:N1+1日前的CL2,NODRAW
{倒数第三次死叉与倒数第二次死叉之间的最低收盘价}DIFL3:=N1+1日前的DIFL2,NODRAW
PDIFL2:=IF(DIFL2>0,INTPART(LOG(DIFL2))-1,INTPART(LOG(-DIFL2))-1)
MDIFL2:=INTPART(DIFL2/POW(10,PDIFL2))
PDIFL3:=IF(DIFL3>0,INTPART(LOG(DIFL3))-1,INTPART(LOG(-DIFL3))-1)
MDIFL3:=INTPART(DIFL3/POW(10,PDIFL3))
MDIFB2赋值:INTPART(DIF/POW(10,PDIFL2))
MDIFB3赋值:INTPART(DIF/POW(10,PDIFL3))
直接底背离赋值:(CL1MDIFL2) AND (MACD<0 AND 1日前的MACD<0) AND MDIFB2<=1日前的MDIFB2
隔峰底背离赋值:(CL1MDIFL3) AND (MACD<0 AND 1日前的MACD<0) AND MDIFB3<=1日前的MDIFB3
输出B6:直接底背离 OR 隔峰底背离,NODRAW
输出BG:((MDIFB2>1日前的MDIFB2)*1日前的直接底背离) OR ((MDIFB3>1日前的MDIFB3)*1日前的隔峰底背离),NODRAW
底背离消失:=(1日前的直接底背离 AND DIFL1<=DIFL2 ) OR (1日前的隔峰底背离 AND DIFL1<=DIFL3)
DRAWTEXT(TFILTER(B6,MACD>0,1),(DIF+MACD),'钝化'),画红色
当满足条件B6 OR BG时,在DIF和DEA之间画柱状线
DRAWTEXT(TFILTER(底背离消失,B6,1),(DIF+MACD),'消失'),画黄色
DRAWTEXT(TFILTER(BG,MACD>0,1),DIF*1.1,'M底背'),画洋红色
{顶部结构预警}金叉:=DIF上穿DEA
M1赋值:上次金叉距今天数,NODRAW
{最近一次金叉的位置}M2赋值:REF(上次金叉距今天数,M1+1),NODRAW
{倒数第二次金叉与倒数第一次金叉的区间}M3:=REF(上次金叉距今天数,M2+M1+2),NODRAW
{倒数第三次金叉与倒数第二次金叉的区间}CH1:=M1+1日内C最高值,NODRAW
{最近一次金叉后,最高收盘价}DIFH1:=M1+1日内DIF最高值,NODRAW
CH2赋值:M1+1日前的CH1,NODRAW
{倒数第二次金叉与倒数第一次金叉之间的最高收盘价}DIFH2:=M1+1日前的DIFH1,NODRAW
CH3赋值:M1+1日前的CH2,NODRAW
{倒数第三次金叉与倒数第二次金叉之间的最高收盘价}DIFH3:=M1+1日前的DIFH2,NODRAW
PDIFH2:=IF(DIFH2>0,INTPART(LOG(DIFH2))-1,INTPART(LOG(-DIFH2))-1)
MDIFH2:=INTPART(DIFH2/POW(10,PDIFH2))
PDIFH3:=IF(DIFH3>0,INTPART(LOG(DIFH3))-1,INTPART(LOG(-DIFH3))-1)
MDIFH3:=INTPART(DIFH3/POW(10,PDIFH3))
MDIFT2:=INTPART(DIF/POW(10,PDIFH2))
MDIFT3:=INTPART(DIF/POW(10,PDIFH3))
直接顶背离:=(CH1>CH2 ) AND (MDIFT20 AND 1日前的MACD>0) AND MDIFT2>=1日前的MDIFT2
隔峰顶背离:=(CH1>CH3 AND CH3>CH2 ) AND (MDIFT30 AND 1日前的MACD>0) AND MDIFT3>=1日前的MDIFT3
输出T6:直接顶背离 OR 隔峰顶背离,NODRAW
输出TG:((MDIFT2<1日前的MDIFT2)*1日前的直接顶背离) OR ((MDIFT3<1日前的MDIFT3)*1日前的隔峰顶背离),NODRAW
顶背离消失:=(1日前的直接顶背离 AND DIFH1>=DIFH2 ) OR (1日前的隔峰顶背离 AND DIFH1>=DIFH3)
DRAWTEXT(TFILTER(T6,MACD<0,1),(DIF+MACD),'钝化'),画绿色
DRAWTEXT(TFILTER(顶背离消失,T6,1),(DIF+MACD),'消失'),画黄色
当满足条件T6 OR TG时,在DIF和DEA之间画柱状线
DRAWTEXT(TFILTER(TG,MACD<0,1),DIF*1.02,'M顶背'),画洋红色
{}{}
TRR := SUM(MAX(MAX(最高价-最低价,最高价-1日前的收盘价的绝对值),ABS(最低价-1日前的收盘价)),14)
HD := 最高价-1日前的最高价
LD := 1日前的最低价-最低价
如果HD>0 AND HD>LD返回HD否则返回0
如果LD>0 AND LD>HD返回LD否则返回0
PDI赋值: PDM*100/TRR
MDI赋值: MDM*100/TRR
A1赋值:上次REF(CROSS("MACD.DIF"(12,26,9距今天数,"MACD.DEA"(12,26,9)),1))
B1赋值:A1+1日前的C>C AND REF("MACD.DIF"(12,26,9),A1+1)<"MACD.DIF"(12,26,9) AND CROSS("MACD.DIF"(12,26,9),"MACD.DEA"(12,26,9))
A2赋值:上次REF(CROSS("KDJ.K"(9,3,3距今天数,"KDJ.D"(9,3,3)),1))
B2赋值:A2+1日前的C>C AND REF("KDJ.K"(9,3,3),A2+1)<"KDJ.K"(9,3,3) AND CROSS("KDJ.K"(9,3,3),"KDJ.D"(9,3,3))
A3赋值:上次REF(CROSS("RSI.RSI1"(6,12,24距今天数,"RSI.RSI2"(6,12,24)),1))
B3赋值:A3+1日前的C>C AND REF("RSI.RSI1"(6,12,24),A3+1)<"RSI.RSI1"(6,12,24) AND CROSS("RSI.RSI1"(6,12,24),"RSI.RSI2"(6,12,24))
C1赋值:上次REF(CROSS("MACD.DEA"(12,26,9距今天数,"MACD.DIF"(12,26,9)),1))
D1赋值:C1+1日前的C"MACD.DIF"(12,26,9) AND CROSS("MACD.DEA"(12,26,9),"MACD.DIF"(12,26,9))
C2赋值:上次REF(CROSS("KDJ.D"(9,3,3距今天数,"KDJ.K"(9,3,3)),1))
D2赋值:C2+1日前的C"KDJ.K"(9,3,3) AND CROSS("KDJ.D"(9,3,3),"KDJ.K"(9,3,3))
C3赋值:上次REF(CROSS("RSI.RSI2"(6,12,24距今天数,"RSI.RSI1"(6,12,24)),1))
D3赋值:C3+1日前的C"RSI.RSI1" AND "RSI.RSI2"上穿"RSI.RSI1"
当满足条件B2>0时,在DIF*1.2和'K底'位置书写文字
当满足条件D2>0时,在DIF*1.2和'K顶'位置书写文字
当满足条件B3>0时,在DIF*1和'R底'位置书写文字
当满足条件D3>0时,在DIF*1和'R顶'位置书写文字
{卧底藏龙}{副图}{选股}TDJ1赋值:(H-L)/1日前的C>0.05
YUL1赋值:统计5日满足TDJ1的天数>1
TU1赋值:收盘价/C的40日简单移动平均<0.74
启动1赋值:TDJ1 AND YUL1 AND TU1
ZC赋值:1日前的收盘价
VAR1赋值:SMA(收盘价-ZC和0较大值,7,1)/SMA(收盘价-ZC的绝对值,7,1)*100
VAR2赋值:((C的30日简单移动平均-最低价)/C的60日简单移动平均)*200
GL1赋值:FILTER(1日前的VAR1<20 AND VAR1>1日前的VAR1,5)
波段1赋值:FILTER(GL1 AND 1日前的启动1 AND VAR2>20 AND C>1日前的C,10)
MA5赋值:C的5日指数移动平均
EM5赋值:MA5的5日指数移动平均
VAR3赋值:MA5-EM5的绝对值
VAR4赋值:MA5-1日前的MA5
VAR5赋值:VAR4-1日前的VAR4
VAR6赋值:(VAR4+VAR5)/2
TDF1赋值:POW(VAR3,1)*POW(VAR6,3)
NTDF1赋值:TDF1/HHV(TDF1的绝对值,15)
确定1赋值:波段1 AND NTDF1上穿-0.05
选股1赋值:FILTER(1日前的启动1 AND (确定1 OR C>1日前的C) AND "MACD.MACD"(12,26,9)>-1.5,10)
输出卧底1:(统计13日满足选股1的天数>=1 AND (波段1 OR 确定1))*0.4,画红色
当满足条件卧底1=0.4时,在0.3和'←卧底'位置书写文字
{倍量副图源码如下}TOTAL赋值:IF(周期类型=1,5,IF(周期类型=2,15,IF(周期类型=3,30,IF(周期类型=4,60,IF(周期类型=5,TOTALFZNUM,1)))))
MTIME赋值:MOD(FROM开盘价,TOTAL)
如果MTIME<0.5返回TOTAL否则返回MTIME
如果 到最后交易的周期=1 AND 周期类型=5返回成交量*240/FROM开盘价否则返回DRAWNULL
当满足条件 到最后交易的周期=1 AND 周期类型=5时,在V成交量和0之间画柱状线
输出VOLUME:成交量,成交量STICK
AA赋值:成交量>1日前的V*1.9
{倍量} {AA1赋值:成交量[} AA1赋值:V/1日前的V<=0.6]
当满足条件AA时,在0和V之间画柱状线
当满足条件AA1时,在0和V之间画柱状线
输出MV5:V的5日简单移动平均画黄色
输出MV35:V的35日简单移动平均画洋红色
输出{启动} MV135:V的135日简单移动平均COLOR1D7300
{异动} DRAWICON(MV5上穿MV135,MV5,1)
{5日上穿135日做记号}
输出{振幅副图源码如下}振幅:((H-L)/1日前的C)*100,画红色,NODRAW
当满足条件振幅<2时,在0和振幅之间画柱状线
当满足条件3>振幅 AND 振幅>=2时,在0和振幅之间画柱状线
当满足条件3>振幅 AND 振幅>=2时,在0和2之间画柱状线
当满足条件5>振幅 AND 振幅>=3时,在0和振幅之间画柱状线
当满足条件5>振幅 AND 振幅>=3时,在2和3之间画柱状线
当满足条件5>振幅 AND 振幅>=3时,在0和2之间画柱状线
当满足条件10>振幅 AND 振幅>=5时,在0和振幅之间画柱状线
当满足条件10>振幅 AND 振幅>=5时,在3和5之间画柱状线
当满足条件10>振幅 AND 振幅>=5时,在2和3之间画柱状线
当满足条件10>振幅 AND 振幅>=5时,在0和2之间画柱状线
当满足条件振幅>=10时,在0和振幅之间画柱状线
当满足条件振幅>=10时,在5和10之间画柱状线
当满足条件振幅>=10时,在3和5之间画柱状线
当满足条件振幅>=10时,在2和3之间画柱状线
当满足条件振幅>=10时,在0和2之间画柱状线
3
5
10
输出{呆呆兔主图源码如下}分时均价:成交额/成交量/100,NODRAW,画黄色
输出{变色加粗BBI}BBI:(收盘价的3日简单移动平均+收盘价的6日简单移动平均+收盘价的12日简单移动平均+收盘价的24日简单移动平均)/4, 线宽为2
如果C>=BBI返回BBI否则返回DRAWNULL
如果C输出{近日最高最低价画线}近日高:IF( 到最后交易的周期<=CONST(FIND最高价BARS(最高价,0,6,1)+1),CONST(FIND最高价(最高价,0,6,1)),DRAWNULL),画红色, 线宽为1
输出近日低:IF( 到最后交易的周期<=CONST(FIND最低价BARS(最低价,0,6,1)+1),CONST(FIND最低价(最低价,0,6,1)),DRAWNULL),画绿色, 线宽为1
DRAWSL(ISLASTBAR,近日高,0,2000,1),画红色, 线宽为1
DRAWSL(ISLASTBAR,近日低,0,2000,1),画绿色, 线宽为1
如果日期>=1200824返回1否则返回0
KCB赋值:IF(INBLOCK('科创板'),1,0)
CYB赋值:IF(INBLOCK('创业板') AND RQ,1,0)
{20%涨停洋红色,跌停蓝色}STICKLINE(C/1日前的C>1.195 AND C=H AND (KCB OR CYB) AND 周期类型=5,O,C,3,0),画洋红色
STICKLINE(C/1日前的C<0.805 AND C=L AND (KCB OR CYB) AND 周期类型=5,O,C,3,0), 画蓝色
{10%涨停红色,跌停绿色}STICKLINE(C/1日前的C>1.095 AND C=H AND NOT(KCB OR CYB) AND 周期类型=5,O,C,3,0),画红色
STICKLINE(C/1日前的C<0.905 AND C=L AND NOT(KCB OR CYB) AND 周期类型=5,O,C,3,0),画绿色
当满足条件1时,在横轴0.00纵轴0.00位置书写文字
DRAWTEXT_FIX(1,0.05,0.00,0,EXTERNSTR(0,1))COLOR0000FF
当满足条件1时,在横轴0.00纵轴0.07位置书写文字
DRAWTEXT_FIX(1,0.05,0.07,0,EXTERNSTR(0,2))COLORFF00FF
当满足条件1时,在横轴0.00纵轴0.14位置书写文字
DRAWTEXT_FIX(1,0.00,0.14,0,EXTERNSTR(0,3))COLOR00FF00
当满足条件1时,在横轴0.00纵轴0.21位置书写文字
DRAWTEXT_FIX(1,0.05,0.21,0,EXTERNSTR(0,4))画黄色
当满足条件1时,在横轴0.00纵轴0.28位置书写文字
DRAWTEXT_FIX(1,0.05,0.28,0,EXTERNSTR(0,5))画黄色
{周标记}JZX赋值:WEEKDAY<>1日前的WEEKDAY
{时间取值取周}DRAWNUMBER(JZX,L,WEEKDAY)画黄色