這個(gè)寫(xiě)法是我對MACD頂底背離的一些理解,有時(shí)不夠精確,指標是死了,人可是活的,呵呵! DIFF : EMA(CLOSE,S) - EMA(CLOSE,P),colorred;//(這句表達的是S天與P天股價(jià)指數平滑曲線(xiàn)的差值,用紅色表示) DEA : EMA(DIFF,M),coloryellow;//(這句表達的是第一句M天的指數平滑曲線(xiàn),用黃色表示) MACD : 2*(DIFF-DEA), COLORSTICK;//(這句表達的第一句和第二句差值的柱狀線(xiàn))
A4:=BARSLAST(ref(cross(diff,dea),1)); B1:=ref(h,A4+3)>ref(c,3) and ref(diff,A4+3)<ref(diff,3) and cross(diff,dea); DRAWTEXT(FILTER(B1>0,5),diff,'←底背離'),COLORyellow; A5:=BARSLAST(ref(cross(dea,diff),1)); B2:=ref(h,A5+3)<ref(h,3) and ref(diff,A5+3)>ref(diff,3) and cross(dea,diff); DRAWTEXT(FILTER(B2>0,5),diff,'←頂背離'),COLORgreen;
partline(diff<ref(diff,1),diff),colorgreen;//(這句是我自己加的,DIFF上升紅色,下降綠色,方便看盤(pán)而已,飛狐可用)。 以上是原碼,原汁原味!
p,26,1,500 s,12,1,500 m,9,1,500 |