通达信——【MACD上主图】万能指标随便...
通达信——【MACD上主图】万能指标随便用都可!
最近在头条上跟很多朋友一起交流,也学到了很多,受益匪浅,!
今天借用壹老师8年多前的“万能叠加”指标,自行研究成功将MACD叠加上主图,最关键的是还将MACD红绿杠也搬上了主图,并叠加上了顶底背离信号,以此回馈各位同学老师,无未来不漂移,各位尽管拿去!
源码附上:{0. 将MACD指标搬上主图显示}
DDIF:EMA(CLOSE,12)-EMA(CLOSE,26),NODRAW;
DDEA:EMA(DDIF,9),NODRAW;
DMACD:(DDIF-DDEA)*2,NODRAW;
上市天数:=BARSCOUNT(C);
N:=IF(上市天数<90,上市天数-1,90);
基点:=CONST(LLV(L,N));
基:=CONST(HHV(H,N))-基点;
分:=CONST(LLV(DDIF,N));
百:=CONST(HHV(DDIF,N))-分;
CC比:=(DDIF-分)/百;
XCX:=CC比*基+基点;
DIF:=XCX; NOTEXTDDIF:DIF,COLORWHITE;
DEA:=EMA(DIF,9); NOTEXTDDEA:DEA,COLORYELLOW;
基准零线:=(0-分)/百*基+基点; NOTEXT基准零线:基准零线,POINTDOT,COLORLIRED;
MACD:=(DIF-DEA)*2;
TICKLINE(MACD>=0,基准零线,基准零线+MACD,0,0),COLORLIRED; STICKLINE(MACD<0,基准零线,基准零线+MACD,0,0),COLORLICYAN;
{1.
MACD结构量化指标:}
A1:=BARSLAST(REF(CROSS(DIF,DEA),1));
底部结构:=REF(C,A1+1)>C
AND DIF>REF(DIF,A1+1) AND CROSS(DIF,DEA);
DRAWLINE(A1=0,REF(DEA,1),底部结构,REF(DEA,A1+1),0),COLORMAGENTA,LINETHICK1;
STICKLINE(底部结构,DEA,REF(DEA,A1+1),0,0),COLORMAGENTA,LINETHICK1;
DRAWTEXT(底部结构>0,REF(DEA,A1+1),'底背离'),COLORMAGENTA;
A2:=BARSLAST(REF(CROSS(DEA,DIF),1)); 顶部结构:=REF(C,A2+1)<C AND REF(DIF,A2+1)>DIF AND CROSS(DEA,DIF); DRAWLINE(A2=0,REF(DEA,1),顶部结构,REF(DEA,A2+1),0),COLORGREEN,LINETHICK1;
TICKLINE(顶部结构,DEA,REF(DEA,A2+1),0,0),COLORGREEN,LINETHICK1;
DRAWTEXT(顶部结构>0,REF(DEA,A2+1),'顶背离'),COLORGREEN;#我要上微头条#