第一個(gè)是MACD指標(biāo)的紅綠柱子背離,注意設(shè)置參數(shù): DIF:EMA(CLOSE,12)-EMA(CLOSE,26); DEA:EMA(DIF,9); MACD:(DIF-DEA)*2,COLORSTICK; NOTEXTA:IF(MACD>REF(MACD,1),MACD,0),STICK,COLORRED; NOTEXTB:IF(MACD<REF(MACD,1),MACD,0),STICK,COLORGREEN; N1:BARSLAST(REF(MACD,1)<0 AND MACD>0),NODRAW; N2:LLVBARS(MACD,N1+20),NODRAW; N3:=IF(N2>N1,REF(MACD,N2),0); N4:=MACD<0 AND MACD>N3 AND LOW=LLV(LOW,N1+20) AND N3<0; N5:=REF(N4,1)=1 AND MACD>REF(MACD,1) AND REF(DIF,N2)<0 AND MACD<0; 底背離:DRAWLINE(N3=N2,MACD,N5,MACD,0),COLORRED,LINETHICK2; N6:=HHVBARS(MACD,N1+20); N7:=IF(N6>N1,REF(MACD,N6),0); N8:=MACD>0 AND MACD<N7 AND HIGH=HHV(HIGH,N1+20) AND N7>0; N9:=REF(N8,1)=1 AND MACD>REF(MACD,1) AND REF(DIF,N6)>0; 頂背離:DRAWLINE(N7=N6,MACD,N9,MACD,0),COLORGREEN,LINETHICK2; 第二個(gè)是關(guān)于MACD金叉死叉的背離,也要注意設(shè)置參數(shù): 零軸:0,COLORWHITE; DIF:(EMA(CLOSE,SHORT)-EMA(CLOSE,LONG)),COLORRED; DEA:(EMA(DIF,MID))COLORBLUE; MACD:(DIF-DEA)*2,COLORSTICK; STICKLINE(MACD>=0,0,MACD,0,0),COLORRED;{0上升} STICKLINE(MACD>=0 AND MACD<REF(MACD,1),0,MACD,0,0),COLORGREEN;{0上跌} STICKLINE(MACD<0,0,MACD,0,0),COLORGREEN;{0下跌} STICKLINE(MACD<0 AND MACD>REF(MACD,1),0,MACD,0,0),COLORRED;{0下升}; A1:=COUNT(CROSS(DIF,DEA),BARSLAST(DEA>0))=1; AA1:=DEA<0 AND CROSS(DIF,DEA) AND A1; A2:=COUNT(CROSS(DIF,DEA),BARSLAST(DEA>0))=2; AA2:=DEA<0 AND CROSS(DIF,DEA) AND A2; A3:=COUNT(CROSS(DIF,DEA),BARSLAST(DEA>0))=3; AA3:=DEA<0 AND CROSS(DIF,DEA) AND A3; A4:=COUNT(CROSS(DIF,DEA),BARSLAST(DEA>0))=4; AA4:=DEA<0 AND CROSS(DIF,DEA) AND A4; A:=AA1 OR AA2 OR AA3 OR AA4; B1:=COUNT(CROSS(DEA,DIF),BARSLAST(DIF<0))=1; BB1:=DIF>0 AND CROSS(DEA,DIF) AND B1; B2:=COUNT(CROSS(DEA,DIF),BARSLAST(DIF<0))=2; BB2:=DIF>0 AND CROSS(DEA,DIF) AND B2; B3:=COUNT(CROSS(DEA,DIF),BARSLAST(DIF<0))=3; BB3:=DIF>0 AND CROSS(DEA,DIF) AND B3; B4:=COUNT(CROSS(DEA,DIF),BARSLAST(DIF<0))=4; BB4:=DIF>0 AND CROSS(DEA,DIF) AND B4; B5:=COUNT(CROSS(DEA,DIF),BARSLAST(DIF<0))=5; BB5:=DIF>0 AND CROSS(DEA,DIF) AND B5; B6:=COUNT(CROSS(DEA,DIF),BARSLAST(DIF<0))=6; BB6:=DIF>0 AND CROSS(DEA,DIF) AND B6; B7:=COUNT(CROSS(DEA,DIF),BARSLAST(DIF<0))=7; BB7:=DIF>0 AND CROSS(DEA,DIF) AND B7; B8:=COUNT(CROSS(DEA,DIF),BARSLAST(DIF<0))=8; BB8:=DIF>0 AND CROSS(DEA,DIF) AND B8; B:=BB1 OR BB2 OR BB3 OR BB4 OR BB5 OR BB6 OR BB7 OR BB8; N1:=BARSLAST(REF(CROSS(DIF,DEA),1)); 底背離:=REF(CLOSE,N1+1)>CLOSE AND DEA>REF(DEA,N1+1) AND CROSS(DIF,DEA); DRAWLINE(N1=0,DEA,底背離,DEA,0),COLORLIMAGENTA,LINETHICK2; 底背離2:=REF(CLOSE,N1+1)<CLOSE AND DEA<REF(DEA,N1+1) AND CROSS(DIF,DEA); DRAWLINE(N1=0,DEA,底背離2,DEA,0),COLORLIMAGENTA,LINETHICK2; N2:=BARSLAST(REF(CROSS(DEA,DIF),1)); 頂背離1:=REF(CLOSE,N2+1)<CLOSE AND REF(DEA,N2+1)>DEA AND CROSS(DEA,DIF) AND DIF>0; DRAWLINE(N2=0,DEA,頂背離1,DEA,0),COLORGREEN,LINETHICK2; 頂背離2:=REF(CLOSE,N2+1)>CLOSE AND REF(DEA,N2+1)<DEA AND CROSS(DEA,DIF) AND DIF>0; DRAWLINE(N2=0,DEA,頂背離2,DEA,0),COLORGREEN,LINETHICK2; DRAWICON(A,DIF,1); DRAWICON(B,DIF,2); DRAWICON(CROSS(DIF,DEA) AND DIF>0,DIF,25); M1:=BARSLAST(DIF<0); T1 :=REF(CROSS(DEA,DIF),1) AND CROSS(DIF,DEA); T:=COUNT(T1,M1)=2 AND T1; DRAWICON(T,0,9); N3:=BARSLAST(CROSS(DEA,DIF)); N4:=BARSLAST(MACD<REF(MACD,1)); T2:=EVERY(DEA>0,N3) AND DIF>1.009*REF(DIF,1) AND MACD>REF(MACD,1) AND N4=1 AND COUNT(DIF>DEA,N3)=0; T3:=DIF>DEA AND CROSS(DEA,MACD); DRAWICON(T3,MACD,35); T4:=DIF<DEA AND CROSS(MACD,DEA); DRAWICON(T4,MACD,34); |
|
來(lái)自: 風(fēng)信子d0w17xnr > 《玲指》