MACD柱体与股价的顶底背离画线源码
2020/2/18 19:09:32
公式编写说明:
求:MACD柱体与股价的顶、底背离画线源码?MACD源码:DIF:(EMA(CLOSE,12)-EMA(CLOSE,26))*100,COLOR0000FF,LINETHICK1;DEA:EMA(DIF,9),COLORFFFFFF,LINETHICK1;MACD:(DIF-DEA)*2,COLORYELLOW; STICKLINE(MACD>=0,MACD,0,1,1),COLORRED;STICKLINE(MACD<0,MACD,0,1,1),COLORGREEN;也可以用通达信系统自带源码!
公式源码回答:
DIF:(EMA(CLOSE,12)-EMA(CLOSE,26))*100,COLOR0000FF,LINETHICK1;
DEA:EMA(DIF,9),COLORFFFFFF,LINETHICK1;
MACD:(DIF-DEA)*2,COLORYELLOW;
STICKLINE(MACD>=0,MACD,0,1,1),COLORRED;
STICKLINE(MACD<0,MACD,0,1,1),COLORGREEN;
ZERO : 0;
GJ:=MAX(C,O);
L4:=LLV(GJ,4);
JL:=(HHV(DIF,60)-LLV(DIF,60))/5;
GT:=DEA>REF(DEA,1) AND REF(DEA,1)<REF(DEA,2);
A1:=BARSLAST(REF(gt,1));
底背离:=REF(L4,A1+1)>CLOSE AND DIF>REF(DIF,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.12,' 底背离'),COLORFF00FF;
H4:=HHV(GJ,4);
GT2:=DEA<REF(DEA,1) AND REF(DEA,1)>REF(DEA,2);
A2:=BARSLAST(REF(GT2,1));
顶背离:= REF(H4,A2+1)<H4 AND DIF<REF(DIF,A2+1) AND GT2;
DRAWLINE(A2=0 ,DEA,顶背离,REF(DEA,A2),0),colorgreen,LINETHICK2;
DRAWLINE(顶背离,DEA,顶背离,REF(DEA,A2),0),colorgreen,LINETHICK2;
DRAWTEXT(顶背离,REF(DEA,A2)*1.12,' 顶背离'),colorgreen;
投股 票网 www.tou1 8.cn
股市公式下载推荐