将这个MACD公式改成通达信
更多金钻指标股票技术讨论QQ群:966329692 技术讨论QQ群:220302856 技术讨论QQ群:39652085 如群满可换一个

编写要求:

DIFF:=EMA(CLOSE,12) - EMA(CLOSE,26);DEA:=EMA(DIFF,9);MACD:2*(DIFF-DEA), COLORSTICK;MACD1:SMA(MACD,3,1);MACD2:SMA(MACD1,3,1);中线:=EMA(SLOPE(C,21)*20+C,55);短线:=MA(CLOSE-中线,5)+中线;副线:=SMA(短线,3,1);UPR:=中线+3*STD(中线,10);DWN:=中线-3*STD(中线,10);上:HHV(MACD,20),COLORGRAY,DOTLINE;金叉:CROSS(副线,中线) AND 短线>=副线 AND BARSLAST(MACD=上)<=10,PRECIS0,LINETHICK0;drawbmp(金叉,0,'buy1.bmp'),align1,valign2;准备区:last(中线>REF(中线,1) AND 副线>REF(副线,1) AND BARSLAST(金叉)<=10),COLOR00FFFF,PRECIS0,LINETHICK0;窄:=(UPR-DWN)/DWN*100;拐头:UPR>=REF(UPR,1) AND REF(UPR,1)=UPR AND 短线>=REF(短线,1) AND BARSLAST(窄=LLV(窄,30))<=5 AND BARSLAST(MACD=上)<=10,COLORYELLOW,PRECIS0,LINETHICK0;STICKLINE(拐头,MACD,0,8,1),COLORYELLOW,LINETHICK1;操作区:last(短线>=UPR AND 中线>REF(中线,1) AND BARSLAST(拐头)<10),COLORRED,PRECIS0,LINETHICK0;阴:=(LOW<=副线 AND CLOSE<短线) OR (CLOSE副线 AND REF(短线,1)<=REF(副线+0.01,1)) AND 短线>=中线 AND 中线>=REF(中线,1) AND MACD>=0 AND MACD1>=MACD2,PRECIS0,COLORWHITE,LINETHICK0;STICKLINE(交叉,MACD1,MACD2,3,0),COLORWHITE,LINETHICK1;下:LLV(MACD,20),COLORCYAN,PRECIS2,DOTLINE;PARTLINE(上,MACD=上,RGB(255,255,255));PARTLINE(MACD1,操作区,RGB(255,0,0)),LINETHICK2;PARTLINE(MACD1,准备区,RGB(255,255,255)),LINETHICK2;FILLRGN(0,MACD2,0>MACD2 AND 0副线 AND 中线+0.01<短线 AND BARSLAST(MACD=上)<=10,RGB(0,255,0));0,DOTLINE,PRECIS0;

解答:

 DIFF:=EMA(CLOSE,12) - EMA(CLOSE,26);

DEA:=EMA(DIFF,9);
MACD:2*(DIFF-DEA), COLORSTICK;
MACD1:SMA(MACD,3,1);
MACD2:SMA(MACD1,3,1);
 
中线:=EMA(SLOPE(C,21)*20+C,55);
短线:=MA(CLOSE-中线,5)+中线;
副线:=SMA(短线,3,1);
UPR:=中线+3*STD(中线,10);
DWN:=中线-3*STD(中线,10);
上:HHV(MACD,20),COLORGRAY,DOTLINE;
 
金叉:CROSS(副线,中线) AND 短线>=副线  AND BARSLAST(MACD=上)<=10,NODRAW;
DRAWICON(金叉,0.05,7),COLORYELLOW;
准备区:BARSLASTCOUNT(中线>REF(中线,1) AND 副线>REF(副线,1) AND BARSLAST(金叉)<=10),COLOR00FFFF,NODRAW;
 
窄:=(UPR-DWN)/DWN*100;
拐头:UPR>=REF(UPR,1) AND REF(UPR,1)<REF(UPR,2) AND 短线>=UPR AND 短线>=REF(短线,1) AND BARSLAST(窄=LLV(窄,30))<=5 AND BARSLAST(MACD=上)<=10,COLORYELLOW,NODRAW;
STICKLINE(拐头,MACD,0,3,1),COLORYELLOW;
操作区:BARSLASTCOUNT(短线>=UPR AND 中线>REF(中线,1) AND BARSLAST(拐头)<10),COLORRED,NODRAW;
阴:=(LOW<=副线 AND CLOSE<短线) OR (CLOSE<REF(CLOSE,1) AND CLOSE<OPEN);
低买:(准备区 OR 操作区) AND 阴,NODRAW;
DRAWICON(低买,0.1,1);
交叉:(短线>副线 AND REF(短线,1)<=REF(副线+0.01,1)) AND 短线>=中线 AND 中线>=REF(中线,1) AND MACD>=0 AND MACD1>=MACD2,COLORWHITE,NODRAW;
STICKLINE(交叉,MACD1,MACD2,3,0),COLORWHITE,LINETHICK1;
下:LLV(MACD,20),COLORCYAN,DOTLINE;
 
IF(MACD=上,上,DRAWNULL),COLORWHITE;
IF(操作区,MACD1,DRAWNULL),LINETHICK2,COLORRED;
IF(准备区,MACD1,DRAWNULL),LINETHICK2,COLORWHITE;
STICKLINE(0>MACD2 AND 0<MACD1,0,MACD2,2,0),COLORGREEN;
STICKLINE(中线>副线 AND 中线+0.01<短线 AND BARSLAST(MACD=上)<=10,MACD1,MACD2,2,0),COLORGREEN;
0,DOTLINE;

选股票看什么指标最好 >股票指标网