[大智慧指标] MACD红绿柱面积公式(大智慧指标)

0
回复
3837
查看
[复制链接]

87

主题

6

回帖

1289

积分

超级版主

积分
1289
来源: 2020-6-10 22:47:30 显示全部楼层 |阅读模式

MACD红绿柱面积公式:
  1. DIF : 10*(EMA(CLOSE,short) - EMA(CLOSE,long));
  2. DEA : EMA(DIF,mid);
  3. MACD : 2*(DIF-DEA), COLORSTICK;

  4. {面积计算}//注:SUM(MACD在N周期内的总和 BARLAST上一次条件成立(macd>0)到当前的周期数;
  5. 绿面积:IF (MACD<0,SUM(MACD,BARSLAST(MACD>0)) * 100,0),linethick0,colorgreen;
  6. 红面积:IF (MACD>0,SUM(MACD,BARSLAST(MACD<0)) * 100,0),linethick0,colorred;

  7. DRAWTEXT( ref(MACD,1)>0 and MACD<=0 ,HHV(MACD,4), NUMTOSTRN(REF(红面积, 1), 3)), colorred,valign2;
  8. DRAWTEXT( ref(MACD,1)<0 and MACD>=0 ,LLV(MACD,4), NUMTOSTRN(REF(绿面积, 1), 3)), colorgreen;
  9. {当前面积}
  10. DRAWTEXT(BARSTATUS=2 and macd>0, -macd*0.03, NUMTOSTRN(红面积, 1),3), coloryellow,valign0, align2;
  11. DRAWTEXT(BARSTATUS=2 and macd<=0, -macd*0.03, NUMTOSTRN(绿面积, 1),3), coloryellow,valign2,align2;

  12. {多空线: 0, colorwhite, dotline;}
  13. stickline(MACD<0 and MACD>=REF(MACD, 1), 0, macd, 0, 0), linethick2,colorwhite;
  14. stickline(MACD<0 and MACD
  15. stickline(MACD>=0 and MACD>REF(MACD, 1), 0, macd, 0, 0), linethick2,colorred;
  16. stickline(MACD>=0 and MACD<=REF(MACD, 1), 0, macd, 0, 0),linethick2, colorwhite;

  17. {根据条件变色绘制dif线,当dif向上时画红线,dif向下时画绿线}
  18. partline(dif,dif>=ref(dif,1),rgb(255,0,0),dif﹤ref(dif,1),rgb(0,255,0)),linethick2;
复制代码
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 免费注册
关注微信