面積MACD 說明: 顯示的面積放大了100倍 纏論輔助,經(jīng)典指標,不贅述... 適用軟件: 大智慧 插件版本: 不需要插件支持
公式源碼:
{參數(shù)設置開始: 大智慧} {INPUT:short(12, 0, 300), long(26, 0, 300), mid(9, 0, 300);} short:=12; long:=26; mid:=9; {參數(shù)設置結(jié)束}
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;
圖例:
|