DIFF : EMA(CLOSE,12) - EMA(CLOSE,26); DEA : EMA(DIFF,9); MACD=2*(DIFF-DEA); ZERO : 0,COLOR000080; GJ:=MAX(C,O); STICKLINE(MACD>0 AND MACD>=REF(MACD,1),0,MACD,2,0),COLORRED; STICKLINE(MACD>0 AND MACD<REF(MACD,1),0,MACD,2,0),COLOR000099; STICKLINE(MACD<0 AND MACD>=REF(MACD,1),0,MACD,2,0),COLOR0A6F00; STICKLINE(MACD<0 AND MACD<REF(MACD,1),0,MACD,2,0),COLOR00FF00; L4:=LLV(GJ,4); JL:=(HHV(DIFF,55)-LLV(DIFF,55))/5; GT:=DEA>REF(DEA,1) AND REF(DEA,1)<REF(DEA,2); A1:=BARSLAST(REF(GT,1)); 底背離:=REF(L4,A1+1)>CLOSE AND DIFF>REF(DIFF,A1+1) AND GT; DRAWLINE(A1=0,DEA,底背離,REF(DEA,A1),0),COLORRED,LINETHICK1; DRAWLINE(底背離,DEA,底背離,REF(DEA,A1),0),COLORRED,LINETHICK1; DRAWTEXT(底背離,REF(DEA,A1)*1.8, '底背離'),COLORFF00FF; H4:=HHV(GJ,4); GT2:=DEA<REF(DEA,1) AND REF(DEA,1)>REF(DEA,2); A2:=BARSLAST(REF(GT2,1)); 頂背離:= REF(H4,A2+1)<H4 AND DIFF<REF(DIFF,A2+1) AND GT2; DRAWLINE(A2=0 ,DEA,頂背離,REF(DEA,A2),0),COLOR004700,LINETHICK1; DRAWLINE(頂背離,DEA,頂背離,REF(DEA,A2),0),COLOR004700,LINETHICK1; DRAWTEXT(頂背離,REF(DEA,A2)*1.2, 頂背離),COLOR004700; A0:=DIFF<0 AND DEA<0; A11:=A0>REF(A0,1); A3:=BARSLAST(A11); A4:=COUNT(DEA>0 AND DIFF >0,A3)=0; A5:=CROSS(DIFF ,DEA); A6:=BARSLAST(A5); A7:=REF(A6,A6+1)+A6; A8:=(DIFF+DEA)/2; A9:=(HIGH+LOW)/2; A10:=A5 AND A7<A3 AND A4 AND A8>REF(A8,A7) AND A9<REF(A9,A7) AND MACD>0; DRAWTEXT(A10,DIFF*1.8,'二次金叉'),COLORYELLOW; 低位金叉:=CROSS(DIFF,DEA) AND DIFF<-0.1; JCCOUNT:=COUNT(CROSS(DIFF,DEA),BARSLAST(DEA>=0)); 二次金叉:=CROSS(DIFF,DEA) AND DEA<0 AND COUNT(JCCOUNT=2,21)=1; DRAWICON(二次金叉,DEA*0.9,1) ; MACDB:2*(DIFF-DEA),COLORSTICK,NODRAW; BV:=SUM(MACDB,0),NODRAW; BA:=IF(MAX(BV,REF(BV,2))<REF(BV,1) OR MIN(BV,REF(BV,2))>REF(BV,1),1,0); BC:=BARSLAST(BA)+1; SMACD:=BV-REF(BV,BC); VAR3:=IF(MACDB>0,HHV(ABS(MACDB),BC),LLV(MACDB,BC)); VAR4:=(MACDB)/20; M1:=REF(MACDB,1); IF(DIFF>=REF(DIFF,1),DIFF,DRAWNULL),COLORGREEN,LINETHICK2; JC:= DEA-DIFF; 綠柱面積:=IF(MACD<0,SUM(MACD,BARSLAST(JC<0)),0); 紅柱面積:=IF(MACD>0,SUM(MACD,BARSLAST(JC>0)),0); 本次最低價:=LLV(L,BARSLAST(JC<0)); 本次最高價:=HHV(H,BARSLAST(JC>0)); X1:=IF (MACD<0,BARSLAST(CROSS(DIFF,DEA)),0); 前次綠柱面積:=REF(綠柱面積,X1+1); 前次最低價:=REF(本次最低價,X1+1); Y1:=IF((綠柱面積<0 AND ABS(綠柱面積)<ABS(前次綠柱面積) AND 本次最低價<前次最低價 ),1,0); RS1:= MACD<0 AND REF(MACD,1)<0 AND C<前次最低價 AND ABS(綠柱面積)<ABS(前次綠柱面積) AND ABS(MACD)<ABS(REF(MACD,1)); 底背馳:= IF (CROSS(DIFF,DEA),REF(Y1,1),0); DRAWTEXT(底背馳,REF(VAR3,1)*2.5,'底背'),COLOR00FFFF; DRAWICON(底背馳,-0.07,1),COLORYELLOW; X2:=IF (MACD>0,BARSLAST(CROSS(DEA,DIFF)),0); 前次紅柱面積:=REF(紅柱面積,X2+1); 前次最高價:=REF(本次最高價,X2+1); Y2:=IF((紅柱面積>0 AND 紅柱面積<前次紅柱面積 AND 本次最高價>前次最高價 ),1,0); RS2:= MACD>0 AND REF(MACD,1)>0 AND C>前次最高價 AND ABS(紅柱面積)<ABS(前次紅柱面積) AND ABS(MACD)<ABS(REF(MACD,1)); 頂背馳:= IF (CROSS(DEA,DIFF),REF(Y2,1),0); DRAWICON(頂背馳,-0.07,2),COLOR00FF00; DRAWTEXT(頂背馳,REF(VAR3,1)*1.2,'頂背'),COLORYELLOW; |
|