MACD顶底背离,三共振
----------------------------------
DIF:EMA(CLOSE,12)-EMA(CLOSE,26);
DEA:EMA(DIF,9);
MACD:(DIF-DEA)*2,NODRAW;
STICKLINE(MACD>REF(MACD,1) AND MACD>0,0,MACD,1,0),COLORRED;
STICKLINE(MACD<REF(MACD,1) AND MACD>0,0,MACD,1,1),COLORWHITE;
STICKLINE(MACD>REF(MACD,1) AND MACD<0,0,MACD,1,0),COLORGREEN;
STICKLINE(MACD<REF(MACD,1) AND MACD<0,0,MACD,1,1),COLORBLUE;
{MACD周值}
周DIF:='MACD.DIF#WEEK';
周DEA:='MACD.DEA#WEEK';
{MACD月值}
月DIF:='MACD.DIF#MONTH';
月DEA:='MACD.DEA#MONTH';
DRAWTEXT(CROSS(DIF,DEA) AND CROSS(周DIF,周DEA) AND CROSS(月DIF,月DEA),MACD*1.02,'三共振'),COLORWHITE;
{底背离}
A1:=BARSLAST(REF(CROSS(DIF,DEA),1));
底背离:=REF(CLOSE,A1 1)>CLOSE AND DIF>REF(DIF,A1 1) AND CROSS(DIF,DEA);
DRAWTEXT(底背离,DIF*0.5,'底背'),COLORRED;
{顶背离}
A2:=BARSLAST(REF(CROSS(DEA,DIF),1));
顶背离:=REF(CLOSE,A2 1)<CLOSE AND REF(DIF,A2 1)>DIF AND CROSS(DEA,DIF);
DRAWTEXT(顶背离,DIF*1.12,'顶背'),COLORGREEN;
{积背离}
绿柱面积:=IF(MACD<0,SUM(MACD,BARSLAST(DEA-DIF<0)),0);
红柱面积:=IF(MACD>0,SUM(MACD,BARSLAST(DEA-DIF>0)),0);
本次最低价:=LLV(L,BARSLAST(DEA-DIF<0));
本次最高价:=HHV(H,BARSLAST(DEA-DIF>0));
X1:=IF (MACD<0,BARSLAST(CROSS(DIF,DEA)),0);
前次绿柱面积:=REF(绿柱面积,X1 1);
前次最低价:=REF(本次最低价,X1 1);
Y1:=IF((绿柱面积<0 AND ABS(绿柱面积)<ABS(前次绿柱面积) AND 本次最低价<前次最低价 ),1,0);
底背驰:=IF(CROSS(DIF,DEA),REF(Y1,1),0);
DRAWTEXT(底背驰,DEA*0.8,'积底背'),COLORFF80FF;
X2:=IF(MACD>0,BARSLAST(CROSS(DEA,DIF)),0);
前次红柱面积:=REF(红柱面积,X2 1);
前次最高价:=REF(本次最高价,X2 1);
Y2:=IF((红柱面积>0 AND 红柱面积<前次红柱面积 AND 本次最高价>前次最高价 ),1,0);
顶背驰:=IF(CROSS(DEA,DIF),REF(Y2,1),0);
DRAWTEXT(顶背驰,DEA*0.8,'积顶背'),COLORCYAN;
周K:='KDJ.K#WEEK';
周D:='KDJ.D#WEEK';
DRAWTEXT(CROSS(周K,周D),0,'KDJ周'),COLORYELLOW;
本站仅提供存储服务,所有内容均由用户发布,如发现有害或侵权内容,请
点击举报。