21027477">N:=7;M:=9;
A:=PERIOD;
BL:=IF(A=0,120,IF(A=1,50,IF(A=2,30,IF(A=3,17,IF(A=4,15,IF(A=5,8,
IF(A=6,3,IF(A=7,2,IF(A=8,50,IF(A=9,3,1.3))))))))));
FM:=(EMA(CLOSE,1.414*N+1));
FCL:=IF(FM<=0.05,ABS(FM)+0.1,0);{防分母为0};
{将DIF提高30,方便观察}
XD_DIF:((EMA(CLOSE,N)-EMA(CLOSE,2*N+2))/(FCL+FM)*100*BL)+30,COLORLIRED,LINETHICK2;
XD_DEA:EMA(XD_DIF,N*0.75),COLORGREEN,LINETHICK2;
MACD:(2*(XD_DIF-XD_DEA))*2.8,COLORRED,COLORSTICK;{将MACD放大2.8,见老师柱子太小,不方便}
{将柱子上色,源码为建立2008老师的,谢谢}
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;
ED:=(-0.4*REF(C,4)-0.4*REF(C,3)-1.1*REF(C,2)+0.9*REF(C,1)+2*C);
RSV:=(SMA(ED,4,1)-LLV(L,M))/(HHV(H,M)-LLV(L,M))*100;
K:SMA(RSV,3,1),COLORWHITE,LINETHICK1;
D:SMA(K,3,1),COLORYELLOW,LINETHICK1;
J:2*K-1*D,COLORMAGENTA,LINETHICK1;
VAR1:=VOL/((HIGH-LOW)*2-ABS(CLOSE-OPEN));
成交阳量:=IF(C>OPEN,VAR1*(H-L),IF(C<OPEN,VAR1*((H-OPEN)+(C-L)),VOL/2));
成交阴量:=IF(C>OPEN,0-VAR1*((H-C)+(OPEN-L)),IF(C<OPEN,0-VAR1*(H-L),0-VOL/2));
MMC:=(成交阳量+成交阴量)/VOL;
SUM_MMC:=SUM(MMC,3);
MMC_RSV:=(SUM_MMC-LLV(SUM_MMC,M))/(HHV(SUM_MMC,M)-LLV(SUM_MMC,M))*100-100;
力度K:SMA(MMC_RSV,5,2),COLORRED,LINETHICK1;
力度D:=SMA(力度K,5,2),COLORBLUE,LINETHICK1;
CL:=C*MMC;
ED2:=(-0.4*REF(CL,4)-0.4*REF(CL,3)-1.1*REF(CL,2)+0.9*REF(CL,1)+2*CL);
力度:SMA(SMA(MAX(ED2-CL,0),3,2)/
SMA(ABS(ED2-CL),3,2),2,1)*100-100,COLORLIBLUE,LINETHICK1;
{加入启动信号,思路嘛,MACD KDJ双金叉}
启动:CROSS(XD_DIF,XD_DEA) AND CROSS(J,K);
DRAWICON(启动,MACD*1.15,9);
|