这个写法是我对MACD顶底背离的一些理解,有时不够精确,指标是死了,人可是活的,呵呵! DIFF : EMA(CLOSE,S) - EMA(CLOSE,P),colorred;//(这句表达的是S天与P天股价指数平滑曲线的差值,用红色表示) DEA : EMA(DIFF,M),coloryellow;//(这句表达的是第一句M天的指数平滑曲线,用黄色表示) MACD : 2*(DIFF-DEA), COLORSTICK;//(这句表达的第一句和第二句差值的柱状线)
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,26,1,500 s,12,1,500 m,9,1,500 |