A:=(3*C+L+O+H)/6;//3倍收盘价与最高价、最低价、开盘价之和的均值。
B:(20*A+19*REF(A,1)+18*REF(A,2)+17*REF(A,3)+16*REF(A,4)+15*REF(A,5)+14*REF(A,6)+13*REF(A,7)+12*REF(A,8)+11*REF(A,9)+10*REF(A,10)+9*REF(A,11)+8*REF(A,12)+7*REF(A,13)+6*REF(A,14)+5*REF(A,15)+4*REF(A,16)+3*REF(A,17)+2*REF(A,18)+REF(A,20))/210;
//对A值做加权均值计算。
D:MA(B,10);//对B值做10周期平均计算。
DIFF:=EMA(CLOSE,SHORT) - EMA(CLOSE,LONG);
DEA:=EMA(DIFF,M);
MACD:=2*(DIFF-DEA);
Zero:=0;
BD:=FILTER(B>D,2);
DB:=FILTER(D>B,2);
DRAWICON(DIFF>0 AND BD AND DIFF>=0.6 ,LOW,1);
DRAWICON(DIFF<0 AND DB AND DIFF<=-0.6,HIGH,2);