以下是通达信副图MACD+KDJ+RSI背离提示公式
通达信副图MACD+KDJ+RSI背离提示公式
源码—
DIF:EMA(CLOSE,12)-EMA(CLOSE,26),COLORGREEN;
DEA:EMA(DIF,9),COLORRED;
MACD:2*(DIF-DEA),COLORSTICK;
D1:=EMA(CLOSE,3)-EMA(CLOSE,8);
D2:=EMA(OPEN,3)-EMA(OPEN,8);
D3:=EMA(HIGH,3)-EMA(HIGH,8);
D4:=EMA(LOW,3)-EMA(LOW,8);
DRAWICON(CROSS(D1,DIF) AND DIF<-0.05,D4-0.1,1);
DRAWICON(CROSS(DIF,D1) AND DIF>0.1,D3 0.1,2);
STICKLINE(D1>=D2,D1,D2,5,0),COLORRED;
STICKLINE(D1<=D2,D1,D2,5,0),COLORGREEN;
A1:=BARSLAST(REF(CROSS(“MACD.DIF”(12,26,9),”MACD.DEA”(12,26,9)),1));
B1:=REF(CLOSE,A1 1)>CLOSE 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));
MACD底背离:=FILTER(B1>0,5);
STICKLINE(MACD底背离,0,0.75,3,0),COLORRED;
DRAWTEXT(MACD底背离,0.57,’MACD底背离’),COLORRED;
A2:=BARSLAST(REF(CROSS(“KDJ.K”(9,3,3),”KDJ.D”(9,3,3)),1));
B2:=REF(CLOSE,A2 1)>CLOSE 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));
KDJ底背离:=FILTER(B2>0,5);
STICKLINE(KDJ底背离,0,1,3,0),COLORLIMAGENTA;
DRAWTEXT(KDJ底背离,0.8,’KDJ底背离’),COLORLIMAGENTA;
A3:=BARSLAST(REF(CROSS(“RSI.RSI1″(6,12,24),”RSI.RSI2″(6,12,24)),1));
B3:=REF(CLOSE,A3 1)>CLOSE 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));
RSI底背离:=FILTER(B3>0,5);
STICKLINE(RSI底背离,0,0.5,3,0),COLORMAGENTA;
DRAWTEXT(RSI底背离,0.25,’RSI底背离’),COLORMAGENTA;
2;
C1:=BARSLAST(REF(CROSS(“MACD.DEA”(12,26,9),”MACD.DIF”(12,26,9)),1));
DD1:=REF(CLOSE,C1 1)<CLOSE 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));
MACD顶背离:=FILTER(DD1>0,5);
STICKLINE(MACD顶背离,2,1,3,0),COLORCYAN;
DRAWTEXT(MACD顶背离,1.5,’MACD顶背离’),COLORCYAN;
C2:=BARSLAST(REF(CROSS(“KDJ.D”(9,3,3),”KDJ.K”(9,3,3)),1));
DD2:=REF(CLOSE,C2 1)<CLOSE 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));
KDJ顶背离:=FILTER(DD2>0,5);
STICKLINE(KDJ顶背离,2,1.2,3,0),COLORGREEN;
DRAWTEXT(KDJ顶背离,1,’KDJ顶背离’),COLORGREEN;
C3:=BARSLAST(REF(CROSS(“RSI.RSI2″(6,12,24),”RSI.RSI1″(6,12,24)),1));
DD3:=REF(CLOSE,C3 1)<CLOSE AND REF(“RSI.RSI1″(6,12,24),C3 1)>”RSI.RSI1″(6,12,24) AND CROSS(“RSI.RSI2″(6,12,24),”RSI.RSI1″(6,12,24));
RSI顶背离:=FILTER(DD3>0,5);
STICKLINE(RSI顶背离,2,1.5,3,0),COLORWHITE;
DRAWTEXT(RSI顶背离,1.75,’RSI顶背离’),COLORBLUE;
评论(0)