超强macd公式,优化版
short.2 200 12
long.2 200 26
MID. 2 200 9
以上参数,请自行设定
DIF1:=EMA(CLOSE,12) - EMA(CLOSE,55),LINETHICK2;
DEA1:=EMA(DIF1,9),LINETHICK2;
MACD1:=2*(DIF1-DEA1),STICK;
MACD2:=EMA(MACD1,3);
STICKLINE(MACD1<REF(MACD1,1)AND MACD1>0,0,MACD1,1,0),COLORBLUE;
STICKLINE(MACD1>REF(MACD1,1)AND MACD1<0,0,MACD1,1,0),COLORRED;
STICKLINE(MACD1>REF(MACD1,1)AND MACD1>0,0,MACD1,1,0),COLORRED;
STICKLINE(MACD1<REF(MACD1,1)AND MACD1<0,0,MACD1,1,0),COLORBLUE;
DIF:DIF1,COLORRED;
DEA:DEA1,COLORLIGRAY;
MACD:MACD1,NODRAW,COLORMAGENTA;
低位金叉:CROSS(DIF1,DEA1) AND DIF1<-0.1;
JCCOUNT:=COUNT(CROSS(DIF1,DEA1),BARSLAST(DEA1>=0.1));
二次金叉:=CROSS(DIF1,DEA1) AND DEA1<0 AND COUNT(JCCOUNT=2,21)=1;
STICKLINE(二次金叉,0,0.06,6,0),COLORCYAN;
DRAWICON(二次金叉,DEA1*0.9,1) ;
DRAWTEXT(二次金叉,0.4,' 二次金叉'),COLORYELLOW;
强度:IF(DIF1>=DEA0.75,DIF1,DRAWNULL),COLORRED,LINETHICK1;
A1:=BARSLAST(REF(CROSS(DIF1,DEA1),1));
底背离:=REF(CLOSE,A1+1)>CLOSE AND DIF1>REF(DIF1,A1+1) AND CROSS(DIF1,DEA1);
STICKLINE(底背离,0,0.03,6,0),COLOR00FF00;
底背:DRAWLINE(A1=0,DEA1,底背离,DEA1,0),COLORRED,LINETHICK1;
DRAWTEXT(底背离,0.1,' 底背离'),COLORYELLOW;
A2:=BARSLAST(REF(CROSS(DEA1,DIF1),1));
顶背离:=REF(CLOSE,A2+1)<CLOSE AND REF(DIF1,A2+1)>DIF1 AND CROSS(DEA1,DIF1);
顶背:DRAWLINE(A2=0,DEA1,顶背离,DEA1,0),COLORGREEN,LINETHICK1;
DRAWTEXT(顶背离,0.1,'顶背离'),COLORGREEN;
VA1:=HHVBARS(MACD,BARSLAST(MACD<0)+1);
VA2:=CROSS(BACKSET(CROSS(0,MACD),REF(VA1,1)+2),0.5);
QG:=CROSS(BACKSET(CROSS(0,MACD) OR (ISLASTBAR AND MACD>0),REF(VA1,1)+2),0.5);
前高:DRAWLINE(VA2,MACD,REF(VA2,1),REF(MACD,1),1),COLORWHITE,LINETHICK3;
654577063.png
|