大智慧改良MACD指标公式

[复制链接]
查看182 | 回复0 | 2021-8-21 11:31:24 | 显示全部楼层 |阅读模式

SHORT:=12;
LONG:=26;
M:=9;
DIFF : EMA(CLOSE,SHORT) - EMA(CLOSE,LONG);
DEA : EMA(DIFF,M);
MACD : 2*(DIFF-DEA), COLORSTICK;
WW :MACD-REF(MACD,1),LINETHICK0;
低位死叉:=CROSS(DEA,DIFF) AND DIFF<0.02;
高位金叉:=CROSS(DIFF,DEA) AND DIFF>-0.02;
STICKLINE(低位死叉,DEA*0.86,DEA*0.66,6,0),COLORYELLOW;
DRAWTEXT(高位金叉,DEA*0.86,' 高金'),COLORFFFFFF;
STICKLINE(MACD<REF(MACD,1)AND MACD>0,0,MACD,3,0 ),COLOR00AAFF;
STICKLINE(MACD<REF(MACD,1)AND MACD>0,0,MACD,2.2,0 ),COLOR00BBFF;
STICKLINE(MACD<REF(MACD,1)AND MACD>0,0,MACD,1.8,0 ),COLOR00CCFF;
STICKLINE(MACD<REF(MACD,1)AND MACD>0,0,MACD,1.3,0 ),COLOR00DDFF;
STICKLINE(MACD<REF(MACD,1)AND MACD>0,0,MACD,0.9,0 ),COLOR00EEFF;
STICKLINE(MACD<REF(MACD,1)AND MACD>0,0,MACD,0.5,0 ),COLOR00FFFF;
STICKLINE(MACD>=REF(MACD,1)AND MACD>0,0,MACD,4 ,0 ),COLOR0000FF;
STICKLINE(MACD>=REF(MACD,1)AND MACD>0,0,MACD,3.3 ,0 ),COLOR0000FF;
STICKLINE(MACD>=REF(MACD,1)AND MACD>0,0,MACD,2.2,0 ),COLOR0000FF;
STICKLINE(MACD>=REF(MACD,1)AND MACD>0,0,MACD,1.65 ,0 ),COLOR0000FF;
STICKLINE(MACD>=REF(MACD,1)AND MACD>0,0,MACD,1.1 ,0 ),COLOR0000FF;
STICKLINE(MACD>=REF(MACD,1)AND MACD>0,0,MACD,0.55 ,0 ),COLOR0000FF;
STICKLINE(MACD>REF(MACD,1)AND MACD<0,0,MACD,4,0 ),COLORAA00BB;
STICKLINE(MACD>REF(MACD,1)AND MACD<0,0,MACD,3.3 ,0 ),COLORBB11BB;
STICKLINE(MACD>REF(MACD,1)AND MACD<0,0,MACD,2.2,0 ),COLORCC22BB;
STICKLINE(MACD>REF(MACD,1)AND MACD<0,0,MACD,1.65,0 ),COLORDD33BB;
STICKLINE(MACD>REF(MACD,1)AND MACD<0,0,MACD,1.1,0 ),COLOREE44BB;
STICKLINE(MACD>REF(MACD,1)AND MACD<0,0,MACD,0.55 ,0 ),COLORFF55BB;
STICKLINE(MACD<=REF(MACD,1)AND MACD<0,0,MACD,4,0 ),COLORFFAA00;
STICKLINE(MACD<=REF(MACD,1)AND MACD<0,0,MACD,3.3 ,0 ),COLORFFBB11;
STICKLINE(MACD<=REF(MACD,1)AND MACD<0,0,MACD,2.2,0 ),COLORFFCC22;
STICKLINE(MACD<=REF(MACD,1)AND MACD<0,0,MACD,1.65 ,0 ),COLORFFDD33;
STICKLINE(MACD<=REF(MACD,1)AND MACD<0,0,MACD,1.1 ,0 ),COLORFFEE44;
STICKLINE(MACD<=REF(MACD,1)AND MACD<0,0,MACD,0.55 ,0 ),COLORFFFF55;
IF(DIFF<0,DIFF,0),COLORRED,LINETHICK1;
IF(DIFF<0,0,DIFF),COLORYELLOW,LINETHICK1;
IF(DIFF<DEA,DIFF,DEA),COLOR00FF00,LINETHICK1;
IF(DIFF>DEA,DEA,DEA),COLORWHITE,LINETHICK1;
IF(DIFF<0,DIFF,0),COLORRED,LINETHICK1;
IF(DIFF<0,0,DIFF),COLORYELLOW,LINETHICK1;
IF(DIFF<DEA,DIFF,DEA),COLOR00FF00,LINETHICK1;
IF(DIFF>DEA,DEA,DEA),COLORWHITE,LINETHICK1;
操盘1号:=EMA(CLOSE,18) - EMA(CLOSE,34);
操盘2号:=EMA(操盘1号,4);
VAR1:=EMA(操盘1号,8);
VAR0:=2.2 * (操盘1号 - VAR1);
中期:=EMA(操盘1号,10);
STICKLINE(操盘2号 > 中期,操盘2号,中期,8,0),COLOR0000FF;
STICKLINE(操盘1号 < 操盘2号,操盘1号,操盘2号,8,0),COLORFFFFFF;

202108211126.jpg

202108211126.jpg

 

回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则