通达信自用多年的实战指标——优化MACD
{打造MACD类最佳指标}
N:=2,90,9;
M1:=2,30,3;
M2:=2,30,3;
RSV:=(CLOSE-LLV(LOW,N))/(HHV(HIGH,N)-LLV(LOW,N))*80,LINETHICK2;
K:=SMA(RSV,M1,1)*0.01,LINETHICK1;
D:=SMA(K,M2,1),LINETHICK1;
J:3*K-2*D,COLORFF00FF,LINETHICK1;
{优化MACD}
DIF:(EMA(CLOSE,12) - EMA(CLOSE,26)),COLORRED,NODRAW;
DEA:EMA(DIF,9),COLOR00FFFF,NODRAW;
MACD:2*(DIF-DEA),NODRAW;
TRLSX1:= MAX(MAX((HHV(DIF,13)-LLV(DIF,13)),ABS(REF(DIF,1)-HHV
(DIF,13))),ABS(REF(DIF,1)-LLV(DIF,13)));
TRLSX2:=EMA(TRLSX1,13);
TRLSX3:=REF(DIF,1)-REF(TRLSX2,1);
DRAWBAND(DIF,RGB(200,50,55),DEA,RGB(50,100,10));
MACDXG2:=REF(COUNT(DIF>0 AND MACD<0 AND MACD
MACD>REF(MACD,1);
STICKLINE(MACDXG2,MACD*1.2,0,2.8,0),COLORFF00FF;
STICKLINE(MACD>REF(MACD,1) AND MACD>0,0,MACD,1.8,0),COLOR000055;
STICKLINE(MACD>REF(MACD,1) AND MACD>0,0,MACD,1.1,0),COLOR000099;
STICKLINE(MACD>REF(MACD,1) AND MACD>0,0,MACD,0.6,0),COLOR0000BB;
STICKLINE(MACD<=REF(MACD,1) AND MACD>0,0,MACD,1.8,0),COLOR888888;
STICKLINE(MACD<=REF(MACD,1) AND MACD>0,0,MACD,1.1,0),COLORBBBBBB;
STICKLINE(MACD<=REF(MACD,1) AND MACD>0,0,MACD,0.6,0),COLORDDDDDD;
STICKLINE(MACD>REF(MACD,1) AND MACD<0,0,MACD,1.8,0),COLOR3377AA;
STICKLINE(MACD>REF(MACD,1) AND MACD<0,0,MACD,1.1,0),COLOR3388BB;
STICKLINE(MACD>REF(MACD,1) AND MACD<0,0,MACD,0.6,0),COLOR4499CC;
STICKLINE(MACD<=REF(MACD,1) AND MACD<0,0,MACD,1.8,0),COLORFF3300;
STICKLINE(MACD<=REF(MACD,1) AND MACD<0,0,MACD,1.1,0),COLORFF5500;
STICKLINE(MACD<=REF(MACD,1) AND MACD<0,0,MACD,0.6,0),COLORFF7700;
{KDJ的月周金叉提示}
月K:=KDJ.K#MONTH,COLOR0080FF;
月D:=KDJ.D#MONTH,COLOR0080FF,LINETHICK2;
周K:=KDJ.K#WEEK,COLORRED;
周D:=KDJ.D#WEEK,COLORRED,LINETHICK2;
STICKLINE(CROSS(月K,月D),J,J*0.95,2,1),COLORRED;
STICKLINE(CROSS(周K,周D),J,J*0.95,2,1),COLORGREEN;
月K金叉:IF(CROSS(月K,月D),0,0),STICK,LINETHICK3,COLORRED;
周K金叉:IF(CROSS(周K,周D),0,0),STICK,LINETHICK3,COLORGREEN;
DRAWTEXT(CROSS(月K,月D),J-0.05,'↖K月金叉'),COLORRED;
DRAWTEXT(CROSS(周K,周D),J-0.05,'↖K周金叉'),COLORGREEN;
{拉升资金}
VAR1D:=EMA(CLOSE,2)-EMA(CLOSE,89);
VAR1E:=EMA(VAR1D,30);
VAR1F:=2*(VAR1D-VAR1E)*2;
VAR20:=POW(VAR1F,3)*0.1+POW(VAR1F,2);
VAR25:=IF(VAR1F>0.015,VAR20,0)/105;