源碼: DIFF:( EMA(CLOSE,12) - EMA(CLOSE,26))*100,colorwhite; DEA: EMA(DIFF,9),coloryellow; MACD:2*(DIFF-DEA); Zero := 0; DRAWTEXT(CROSS(diff,dea),diff*1.05,'↑進') ,colorred; DRAWTEXT(CROSS(dea,diff),diff*1.02,'↓出') ,colorgreen;
低位金叉:IF(CROSS(DIFF,DEA) AND DIFF<-0,15,0),colorcyan,LINETHICK2; JCCOUNT:=COUNT(CROSS(DIFF,DEA),BARSLAST(DEA>=-200)); 二次金叉:IF(CROSS(DIFF,DEA) AND DEA<0 AND COUNT(JCCOUNT=2,21)=1,20,0),COLORff66ff,LINETHICK2; STICKLINE(低位金叉,0,10,5,0),coloryellow; DRAWICON(低位金叉,-1,"BUY");
gj:=MAX(C,O); STICKLINE(MACD>0 AND MACD>=REF(MACD,1),0,MACD,1,0),colorred; STICKLINE(MACD>0 AND MACD<REF(MACD,1),0,MACD,1,0),colorcyan; STICKLINE(MACD<0 AND MACD>=REF(MACD,1),0,MACD,1,0),colorff66ff; STICKLINE(MACD<0 AND MACD<REF(MACD,1),0,MACD,1,0),colorgreen;
A1:=BARSLAST(REF(CROSS(DIFF,DEA),1)); 底背離:IF(REF(CLOSE,A1+1)>CLOSE AND DIFF>REF(DIFF,A1+1) AND CROSS(DIFF,DEA),10,0),colorred; DRAWLINE(A1=0,DEA,底背離,REF(DEA,A1),0),colorred,LINETHICK2; DRAWLINE(底背離,DEA,底背離,REF(DEA,A1),0),colorred,LINETHICK2; DRAWTEXT(底背離,REF(DEA,A1)*0.80,' 底背離'),COLORFF00FF; A2:=BARSLAST(REF(CROSS(DEA,DIFF),1)); 頂背離:REF(CLOSE,A2+1)<CLOSE AND REF(DIFF,A2+1)>DIFF AND CROSS(DEA,DIFF),colorgreen; DRAWLINE(A2=0 ,DEA,頂背離,REF(DEA,A2),0),colorgreen,LINETHICK2; DRAWLINE(頂背離,DEA,頂背離,REF(DEA,A2),0),colorgreen,LINETHICK2; DRAWTEXT(頂背離,REF(DEA,A2)*1.28,' 頂背離'),colorgreen; |