手机端
当前位置:爱约股 > 公式技巧 > 将下面MACD指标改成大智慧新一代的公式

将下面MACD指标改成大智慧新一代的公式

DIFF:EMA(CLOSE,SHORT)-EMA(CLOSE,LONG);
DEA:EMA(DIFF,MID);
MACD:(DIFF-DEA)*2,COLORSTICK;

STICKLINE((MACD > 0),0,MACD,2,0),COLOR0000CC;
STICKLINE((MACD > 0),0,MACD*0.9,2,0),COLOR0000EE;
STICKLINE((MACD > 0),0,MACD*0.8,2,0),COLOR0011FF;
STICKLINE((MACD > 0),0,MACD*0.7,2,0),COLOR0033FF;
STICKLINE((MACD > 0),0,MACD*0.6,2,0),COLOR0055FF;
STICKLINE((MACD > 0),0,MACD*0.5,2,0),COLOR0077FF;
STICKLINE((MACD > 0),0,MACD*0.4,2,0),COLOR0099FF;
STICKLINE((MACD > 0),0,MACD*0.3,2,0),COLOR00BBFF;
STICKLINE((MACD > 0),0,MACD*0.2,2,0),COLOR00DDFF;
STICKLINE((MACD > 0),0,MACD*0.1,2,0),COLOR00FFFF;
STICKLINE((MACD < 0),0,MACD,2,0),COLORCC0033;
STICKLINE((MACD < 0),0,MACD*0.9,2,0),COLOREE0033;
STICKLINE((MACD < 0),0,MACD*0.8,2,0),COLORFF1133;
STICKLINE((MACD < 0),0,MACD*0.7,2,0),COLORFF3333;
STICKLINE((MACD < 0),0,MACD*0.6,2,0),COLORFF5533;
STICKLINE((MACD < 0),0,MACD*0.5,2,0),COLORFF7733;
STICKLINE((MACD < 0),0,MACD*0.4,2,0),COLORFF9933;
STICKLINE((MACD < 0),0,MACD*0.3,2,0),COLORFFBB33;
STICKLINE((MACD < 0),0,MACD*0.2,2,0),COLORFFDD33;
STICKLINE((MACD < 0),0,MACD*0.1,2,0),COLORFFFF33;

强度:IF(DIFF>=DEA,DIFF,DRAWNULL),COLORRED;
低位金叉:=CROSS(DIFF,DEA) AND DIFF<-0.1;
DRAWTEXT(低位金叉,-0.1,' 低位金叉'),COLORYELLOW;
JCCOUNT:=COUNT(CROSS(DIFF,DEA),BARSLAST(DEA>=0));
二次金叉:=CROSS(DIFF,DEA) AND DEA<0 AND COUNT(JCCOUNT=2,21)=1;
DRAWICON(二次金叉,DEA*1.04,13) ;
DRAWTEXT(二次金叉,-0.1,' 二次金叉'),COLORFF00FF;
A1:=BARSLAST(REF(CROSS(DIFF,DEA),1));
底背离:=REF(CLOSE,A1+1)>CLOSE AND DIFF>REF(DIFF,A1+1) AND CROSS(DIFF,DEA);
底背:DRAWLINE(A1=0,DEA,底背离,DEA,0),COLORRED,POINTDOT;
DRAWTEXT(底背离,0.1,'底背离'),COLORMAGENTA;
A2:=BARSLAST(REF(CROSS(DEA,DIFF),1));
顶背离:=REF(CLOSE,A2+1)<CLOSE AND REF(DIFF,A2+1)>DIFF AND CROSS(DEA,DIFF);
顶背:DRAWLINE(A2=0,DEA,顶背离,DEA,0),COLORGREEN,POINTDOT;
DRAWTEXT(顶背离,DIFF,'顶背离'),COLORGREEN;
参数SHORT:2,200,13 LONG:2,200,28 MID:2,200,8
 

 

 

解答如下:

DIFF:EMA(CLOSE,13)-EMA(CLOSE,28);
DEA:EMA(DIFF,8);
MACD:(DIFF-DEA)*2,COLORSTICK;

STICKLINE((MACD > 0),0,MACD,2,0),COLOR0000CC;
STICKLINE((MACD > 0),0,MACD*0.9,2,0),COLOR0000EE;
STICKLINE((MACD > 0),0,MACD*0.8,2,0),COLOR0011FF;
STICKLINE((MACD > 0),0,MACD*0.7,2,0),COLOR0033FF;
STICKLINE((MACD > 0),0,MACD*0.6,2,0),COLOR0055FF;
STICKLINE((MACD > 0),0,MACD*0.5,2,0),COLOR0077FF;
STICKLINE((MACD > 0),0,MACD*0.4,2,0),COLOR0099FF;
STICKLINE((MACD > 0),0,MACD*0.3,2,0),COLOR00BBFF;
STICKLINE((MACD > 0),0,MACD*0.2,2,0),COLOR00DDFF;
STICKLINE((MACD > 0),0,MACD*0.1,2,0),COLOR00FFFF;
STICKLINE((MACD < 0),0,MACD,2,0),COLORCC0033;
STICKLINE((MACD < 0),0,MACD*0.9,2,0),COLOREE0033;
STICKLINE((MACD < 0),0,MACD*0.8,2,0),COLORFF1133;
STICKLINE((MACD < 0),0,MACD*0.7,2,0),COLORFF3333;
STICKLINE((MACD < 0),0,MACD*0.6,2,0),COLORFF5533;
STICKLINE((MACD < 0),0,MACD*0.5,2,0),COLORFF7733;
STICKLINE((MACD < 0),0,MACD*0.4,2,0),COLORFF9933;
STICKLINE((MACD < 0),0,MACD*0.3,2,0),COLORFFBB33;
STICKLINE((MACD < 0),0,MACD*0.2,2,0),COLORFFDD33;
STICKLINE((MACD < 0),0,MACD*0.1,2,0),COLORFFFF33;


PARTLINE(DIFF,DIFF>=DEA,RGB(250,0,0));
低位金叉:=CROSS(DIFF,DEA) AND DIFF<-0.1;
DRAWTEXT(低位金叉,-0.1,' 低位金叉'),COLORYELLOW;
JCCOUNT:=COUNT(CROSS(DIFF,DEA),BARSLAST(DEA>=0));
二次金叉:=CROSS(DIFF,DEA) AND DEA<0 AND COUNT(JCCOUNT=2,21)=1;
DRAWICON(二次金叉,DEA*1.04,13) ;
DRAWTEXT(二次金叉,-0.1,' 二次金叉'),COLORFF00FF;
A1:=BARSLAST(REF(CROSS(DIFF,DEA),1));
底背离:=REF(CLOSE,A1+1)>CLOSE AND DIFF>REF(DIFF,A1+1) AND CROSS(DIFF,DEA);
底背:DRAWLINE(A1=0,DEA,底背离,DEA,0),COLORRED,POINTDOT;
DRAWTEXT(底背离,0.1,'底背离'),COLORMAGENTA;
A2:=BARSLAST(REF(CROSS(DEA,DIFF),1));
顶背离:=REF(CLOSE,A2+1)<CLOSE AND REF(DIFF,A2+1)>DIFF AND CROSS(DEA,DIFF);
顶背:DRAWLINE(A2=0,DEA,顶背离,DEA,0),COLORGREEN,POINTDOT;
DRAWTEXT(顶背离,DIFF,'顶背离'),COLORGREEN;

分享至:

相关推荐