公式名:面积MACD
说明:面积MACD(带变色)
显示的面积放大了100倍
缠论辅助,经典指标,不赘述...
适用软件: 飞狐
插件版本: 不需要插件支持
公式源码:
{参数设置开始}
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);
drawnumber(红显示, DEA*1.03, REF(红柱面积, 1), 0),colorred, pxup30;
drawnumber(绿显示, DEA*0.97, REF(绿柱面积, 1), 0), colorgreen, pxdn20;
{当前面积}
drawnumber(BARSTATUS=2 and macd>0, -macd*0.03, REF(红柱面积, 1), 0),coloryellow, pxdn30;
drawnumber(BARSTATUS=2 and macd<=0, -macd*0.03, REF(绿柱面积, 1), 0), COLORFFCC66, pxup30;
多空线: 0, colorwhite, linedot;
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>=ref(dif,1),dif), colorred;
图例: