通达信公式 周期共振
DIFM:=(EMA(C,240)-EMA(C,520));
DEAM:=EMA(DIFM,180);
MACD(月):(DIFM-DEAM)/2,NODRAW,COLORFFFF00;
DIFW:=(EMA(CLOSE,60)-EMA(CLOSE,130));
DEAW:=EMA(DIFW,45);
MACD(周):(DIFW-DEAW)*2,NODRAW,COLORYELLOW;
DIFD:=(EMA(C,12)-EMA(C,26)),LINETHICK3,COLORMAGENTA;
DEAD:=EMA(DIFD,9),LINETHICK3,COLORBLUE;
MACD(日):(DIFD-DEAD)*2,NODRAW,COLORRED;
STICKLINE(1,0,MACD(月),5.50,0),COLORFFFF00;
STICKLINE(1,0,MACD(周),3.50,0),COLORYELLOW;
STICKLINE(1,0,MACD(日),2.25,0),COLORRED;
短期安全:MACD(日)>REF(MACD(日),1) AND MACD(周)>REF(MACD(周),1),NODRAW,COLORFF0000;
短期风险:(短期安全!=1),NODRAW,COLORFFFFFF;
中期安全:MACD(周)>REF(MACD(周),1) AND MACD(月)>REF(MACD(月),1),NODRAW,COLOR9900FF;
中期风险:(中期安全!=1),NODRAW,COLORGREEN;
DIF2:DIFD,LINETHICK2,COLORFFFFFF;
DIF1:IFF(短期安全,DIFD,DRAWNULL),LINETHICK2,COLORFF0000;
DEA1:DEAD,LINETHICK3,COLORGREEN;
DEA2:IFF(中期安全,DEAD,DRAWNULL),LINETHICK3,COLOR9900FF;