{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;
STICKLINE(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)
DRAWLINE(A2=0,REF(DEA,1),顶部结构,REF(DEA,A2+1),0),COLORGREEN,LINETHICK1;
STICKLINE(顶部结构,DEA,REF(DEA,A2+1),0,0),COLORGREEN,LINETHICK1;
DRAWTEXT(顶部结构>0,REF(DEA,A2+1),'顶背离'),COLORGREEN;
Copyright 2018- www.dyjian.com/ 大宇股票知识网 海口美兰韩哲棚百货商行 版权所有 琼ICP备2023001966号
免责声名:本站所发表的内容仅用于学术交流和学习,内容所带来的一切后果均与本站无关。若您发现本站存在您非授权的原创作品,请第一时间联系本站删除!