SHORT:=12;
LONG:=26;
M:=9;
DIFF:EMA(CLOSE,Short) - EMA(CLOSE,Long);
DEA:EMA(DIFF,M);
macd:2*(DIFF-DEA),COLORSTICK;
MacDHS:=IF(MACD>0 AND MACD>REF(MACD,1),MACD,0);
MACDHX:=IF(MACD>0 AND MACD
MACDLX:=IF(MACD<0 AND MACD
MACDLS:=IF(MACD<0 AND MACD>REF(MACD,1),MACD,0);
红柱面积:=IF(MACD>0,SUM(MACD,BArslAST(MACD<0)),0),PRECIS2,COLOR0000FF;
绿柱面积:=IF(MACD<0,SUM(MACD,BARSLAST(MACD>0)),0),PRECIS2,COLOR006000;
//MACD面积:IF(MACD<0,Abs(绿柱面积),ABS(红柱面积)),NODRAW;
DRAWTEXT(REF(MACD,1)>0 AND MACD<=0 ,HHV(MACD,4),TOSTRING(REF(红柱面积,1),3)),colorred;
DRAWTEXT(REF(MACD,1)<0 AND MACD>=0 ,LLV(MACD,4),TOSTRING(REF(ABS(绿柱面积),1),3)),Color00ff00;
DRAWTEXT(ISNULL(REFX(&CLOSE,1))=1 AND MACD<0,LLV(MACD,4),TOSTRING(ABS(绿柱面积),3)),Color004A00;
DRAWTEXT(ISNULL(REFX(&CLOSE,1))=1 AND MACD>0,HHV(MACD,4),TOSTRING(ABS(红柱面积),3)),colorred;
DIFF : EMA(CLOSE,SHORT) - EMA(CLOSE,LONG);
DEA : EMA(DIFF,M);
MACD : 2*(DIFF-DEA);
gj:=MAX(C,O);
STICKLINE(MACD>0 AND MACD>=REF(MACD,1),0,MACD,2,0),color0000ff;
STICKLINE(MACD>0 AND MACD
STICKLINE(MACD<0 AND MACD>=REF(MACD,1),0,MACD,2,0),colorff00ff;
STICKLINE(MACD<0 AND MACD
L4:=LLV(gj,4);
jl:=(HHV(diff,55)-LLV(diff,55))/5;
gt:=dea>REF(dea,1) AND REF(dea,1)
A1:=BARSLAST(REF(gt,1));
底背离:=REF(L4,A1+1)>CLOSE AND diff>REF(diff,A1+1) AND gt;
DRAWLINE(A1=0,DEA,底背离,REF(DEA,A1),0),colorred,LINETHICK2;
DRAWLINE(底背离,DEA,底背离,REF(DEA,A1),0),colorred,LINETHICK2;
DRAWTEXT(底背离,REF(DEA,A1)*1.18,' 底背离'),COLORFF00FF;
H4:=HHV(gj,4);
gt2:=deaREF(dea,2);
A2:=BARSLAST(REF(gt2,1));
顶背离:= REF(H4,A2+1)
DRAWLINE(A2=0 ,DEA,顶背离,REF(DEA,A2),0),colorgreen,LINETHICK2;
DRAWLINE(顶背离,DEA,顶背离,REF(DEA,A2),0),colorgreen,LINETHICK2;
DRAWTEXT(顶背离,REF(DEA,A2)*1.18,' 顶背离'),colorgreen;
TT:=(2*CLOSE+OPEN+HIGH+LOW);
主导动能:TT/EMA(TT,4)-1,COLORSTICK;
FF:=主导动能;
STICKLINE(FF>0,0,FF,8,0),COLOR33CFDD;
STICKLINE(FF>0 AND FF>REF(FF,1),0,FF,8,0),COLOR0000CC;
STICKLINE(FF<=0,0,FF,8,0),COLOR00CC00;
STICKLINE(FF<=0 AND FF>REF(FF,1),0,FF,8,0),COLORFF9900;
做多主导:IFF(FF>0 AND FF>REF(FF,1),FF,0),NODRAW,COLOR0000CC;
获利回吐:IFF(FF>0 AND FF<=REF(FF,1),FF,0),NODRAW,COLOR33CFDD;
做空主导:IFF(FF<=0 AND FF<=REF(FF,1),FF,0),NODRAW,COLOR00CC00;
空头回补:IFF(FF<=0 AND FF>REF(FF,1),FF,0),NODRAW,COLORFF9900;
DIFF :=EMA(CLOSE,12) - EMA(CLOSE,26),colorwhite;
DEA :=EMA(DIFF,9),coloryellow;
MACD:=2*(DIFF-DEA);
Zero :0;
gj:=MAX(C,O);
STICKLINE(MACD>0 AND MACD>=REF(MACD,1),0,MACD,10,0),color0000ff;
STICKLINE(MACD>0 AND MACD
STICKLINE(MACD<0 AND MACD>=REF(MACD,1),0,MACD,10,0),colorff00ff;
STICKLINE(MACD<0 AND MACD