//MACD基本定义:
EM12:=(EMA(C,12));
EM26:=(EMA(C,26));
DIFF:=EM12-EM26;
DEA:=EMA(DIFF,9);
barz:=2*(DIFF-DEA);
//判断
ss:=DIFf>=0;//水上,多头排列
sx:=DIFf<0;//水下,空头排列
hz:=barz>=0;//dif峰阳面,柱线红
lz:=barz<0;//dif峰阴面,柱线绿
//反映到主图:
PARTLINE(ss,EM26),COLOR0000ff,LINETHICK2;
PARTLINE(sx,EM26),COLORff0000,LINETHICK2;
PARTLINE(hz,EM12),COLORyellow,LINETHICK2;
PARTLINE(lz,EM12),COLORffff00,LINETHICK2;
//附加部件
//缺口
DRAWTEXT(l>REF(H,1),REF(H,1),'←<'),COLORRED;//上涨缺口
DRAWTEXT(h<REF(L,1),REF(L,1),'←<'),COLORGREEN;//下跌缺口
//所属板块
DRAWTEXT(SYSPARAM(2)=BARSCOUNT(C),sysparam(4),'[版块]:'+BLKNAME),Color00A600;