A1:=BARSLAST(REF(CROSS("MACD.DIFF"(12,26,9),"MACD.DEA"(12,26,9)),1));
B1:=REF(CLOSE,A1+1)>CLOSE AND REF("MACD.DIFF"(12,26,9),A1+1)<"MACD.DIFF"(12,26,9) AND CROSS("MACD.DIFF"(12,26,9),"MACD.DEA"(12,26,9));
MACD底背离:=FILTER(B1>0,5);
DRAWICON(MACD底背离,LOW-0.02,8);
DRAWTEXT(MACD底背离,LOW-0.02,' MACD底背离'),COLORMAGENTA;
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);
DRAWICON(KDJ底背离,LOW-0.06,8);
DRAWTEXT(KDJ底背离,LOW-0.06,' KDJ底背离'),COLORCYAN;
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);
DRAWICON(RSI底背离,LOW-0.08,8);
DRAWTEXT(RSI底背离,LOW-0.08,' RSI底背离'),COLORRED;
C1:=BARSLAST(REF(CROSS("MACD.DEA"(12,26,9),"MACD.DIFF"(12,26,9)),1));
D1:=REF(CLOSE,C1+1)<CLOSE AND REF("MACD.DIFF"(12,26,9),C1+1)>"MACD.DIFF"(12,26,9) AND CROSS("MACD.DEA"(12,26,9),"MACD.DIFF"(12,26,9));
MACD顶背离:=FILTER(D1>0,5);
DRAWICON(MACD顶背离,(HIGH)*(1.04),9);
DRAWTEXT(MACD顶背离,(HIGH)*(1.04),' MACD顶背离'),COLORGREEN;
C2:=BARSLAST(REF(CROSS("KDJ.D"(9,3,3),"KDJ.K"(9,3,3)),1));
D2:=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(D2>0,5);
DRAWICON(KDJ顶背离,(HIGH)*(1.025),9);
DRAWTEXT(KDJ顶背离,(HIGH)*(1.025),' KDJ顶背离'),COLORWHITE;
C3:=BARSLAST(REF(CROSS("RSI.RSI2"(6,12,24),"RSI.RSI1"(6,12,24)),1));
D3:=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(D3>0,5);
DRAWICON(RSI顶背离,(HIGH)*(1.01),9);
DRAWTEXT(RSI顶背离,(HIGH)*(1.01),' RSI顶背离'),COLORYELLOW;
MA13:EMA(C,13);
MA34:EMA(C,34);
MA55:EMA(C,55);
PARTLINE(MA13>REF(MA13,1),MA13),COLORRED,LINETHICK2;
PARTLINE(MA13<=REF(MA13,1),MA13),COLORBLUE,LINETHICK2;
PARTLINE(MA34>REF(MA34,1),MA34),COLORMAGENTA,LINETHICK2;
PARTLINE(MA34<REF(MA34,1),MA34),COLORGREEN,,LINETHICK2;
PARTLINE(MA55>REF(MA55,1),MA55),COLORYELLOW,LINETHICK2;
PARTLINE(MA55<REF(MA55,1),MA55),COLORGRAY,LINETHICK2;
DRAWICON(CROSS(MA13,MA34),MA13,10);
DRAWICON(CROSS(MA13,MA55),MA13,10);
DRAWICON(CROSS(MA34,MA55),MA34,10);
DRAWICON(CROSS(MA34,MA13),MA34,11);
DRAWICON(CROSS(MA55,MA13),MA55,11);
DRAWICON(CROSS(MA55,MA34),MA55,11);
STICKLINE(CLOSE>OPEN,OPEN,LOW,0.5,0 ),COLOR0000FF;
STICKLINE(CLOSE>OPEN,CLOSE,HIGH,0.5 ,0 ),COLOR0000FF;
STICKLINE(OPEN>=CLOSE,CLOSE,LOW,0.5 ,0 ),COLOR00FF00;
STICKLINE(OPEN>=CLOSE,OPEN,HIGH,0.5 ,0 ),COLOR00FF00;
STICKLINE(OPEN>=CLOSE ,CLOSE ,OPEN,7,0 ),COLORff7700;
STICKLINE(OPEN>=CLOSE ,CLOSE ,OPEN,6,0 ),COLORff9900;
STICKLINE(OPEN>=CLOSE ,CLOSE ,OPEN,5,0 ),COLORffbb00;
STICKLINE(OPEN>=CLOSE ,CLOSE ,OPEN,4,0 ),COLORffcc00;
STICKLINE(OPEN>=CLOSE ,CLOSE ,OPEN,3,0 ),COLORffdd00;
STICKLINE(OPEN>=CLOSE ,CLOSE ,OPEN,2,0 ),COLORffee00;
STICKLINE(OPEN>=CLOSE ,CLOSE ,OPEN,1,0 ),COLORffFF00;
STICKLINE(CLOSE>OPEN,CLOSE,OPEN,7,0) ,COLOR000055;
STICKLINE(CLOSE>OPEN,CLOSE,OPEN,6,0) ,COLOR000066;
STICKLINE(CLOSE>OPEN,CLOSE,OPEN,5,0) ,COLOR000077;
STICKLINE(CLOSE>OPEN,CLOSE,OPEN,4,0) ,COLOR000099;
STICKLINE(CLOSE>OPEN,CLOSE,OPEN,3,0) ,COLOR0000bb;
STICKLINE(CLOSE>OPEN,CLOSE,OPEN,2,0) ,COLOR0000dd;
STICKLINE(CLOSE>OPEN,CLOSE,OPEN,1,0) ,COLOR0000ff;

 

飞狐顶底背离主图指标公式

 

飞狐顶底背离主图指标公式的选股公式如下: