说明:面积MACD(带变色)
显示的面积放大了100倍
缠论辅助,经典指标,不赘述...
适用软件: 大智慧
插件版本: 不需要插件支持
公式源码:
{参数设置开始: 大智慧}
{INPUT:short(12, 0, 300), long(26, 0, 300), mid(9, 0, 300);}
short:=12; long:=26; mid:=9;
{参数设置结束}
DIF : EMA(CLOSE,short) - EMA(CLOSE,long);
DEA : EMA(DIF,mid);
MACD : 2*(DIF-DEA), COLORSTICK;
{面积计算}
绿面积:IF (MACD<0,SUM(MACD,BARSLAST(MACD>0)) * 100,0),linethick0,colorblue;
红面积:IF (MACD>0,SUM(MACD,BARSLAST(MACD<0)) * 100,0),linethick0,colorred;
红显示:=CROSS(DEA, DIF);
绿显示:=CROSS(DIF, DEA);
DRAWTEXT( 红显示, DEA*1.03, NUMTOSTRN(REF(红面积, 1), 0)), colorred,valign2;
DRAWTEXT( 绿显示, DEA*0.97, NUMTOSTRN(REF(绿面积, 1), 0)), colorgreen;
{当前面积}
DRAWTEXT(BARSTATUS=2 and macd>0, -macd*0.03, NUMTOSTRN(红面积, 0)), coloryellow,valign0, align2;
DRAWTEXT(BARSTATUS=2 and macd<=0, -macd*0.03, NUMTOSTRN(绿面积, 0)), COLORFFCC66,valign2,align2;
多空线: 0, colorwhite, dotline;
stickline(MACD<0 and MACD>=REF(MACD, 1), 0, macd, 0, 0), COLORFFCC66;
stickline(MACD<0 and MACD<REF(MACD, 1), 0, macd, 0, 0), COLORGREEN;
stickline(MACD>=0 and MACD>REF(MACD, 1), 0, macd, 0, 0), COLORRed;
stickline(MACD>=0 and MACD<=REF(MACD, 1), 0, macd, 0, 0), COLORYellow;
partline(dif,dif>=ref(dif,1),rgb(255,0,0),dif<ref(dif,1),rgb(0,255,0)),linethick1;