czsc :MACD拐點(diǎn)和面積公式原碼
說明:本公式不需要設(shè)置參數(shù),按1分鐘級(jí)別走勢(shì)做T+0效果不錯(cuò)。公式原碼如下:
DIF:=EMA(CLOSE,24)-EMA(CLOSE,52);
MACD:=EMA(DIF,18),COLOR33CCFF;
DEF:2*(DIF-MACD),COLORFFFF00,LINETHICK0;
STICKLINE(DEF>=0 AND DEF>=REF(DEF,1),0,DEF,0,0),COLORRED;
STICKLINE(DEF>=0 AND DEF< REF(DEF,1),0,DEF,0.0,0),COLORRED;
STICKLINE(DEF<0 AND DEF>=REF(DEF,1),0,DEF,0.0,0),COLORGREEN;
STICKLINE(DEF<0 AND DEF< REF(DEF,1),0,DEF,0.0,0),COLORGREEN;
IF(DIF<1000,0,DRAWNULL),COLORBROWN;
K1:=BACKSET(DIF>REF(DIF,1),2);
強(qiáng)DIF:IF(K1,DIF,DRAWNULL),COLORRED,LINETHICK2;
K2:=BACKSET(DIF<REF(DIF,1),2);
弱DIF:IF(K2,DIF,DRAWNULL),COLORFF8B80,LINETHICK2;
K3:=BACKSET(MACD>REF(MACD,1),2);
強(qiáng)MACD:IF(K3,MACD,DRAWNULL),COLORLIRED,LINETHICK2;
K4:=BACKSET(MACD<REF(MACD,1),2);
弱MACD:IF(K4,MACD,DRAWNULL),COLORFF8B80,LINETHICK2;
底拐:DRAWLINE(DIF>=HHV(DIF,21),DIF,DIF<=LLV(DIF,21),DIF,0),COLORGREEN,LINETHICK3;
頂拐:DRAWLINE(DIF<=LLV(DIF,21),DIF,DIF>=HHV(DIF,21),DIF,0),COLORYELLOW,LINETHICK3;
DRAWICON(底拐=LLV(DIF,21),底拐*0.97,23);
DRAWICON(頂拐=HHV(DIF,21),頂拐*1.03,14);
AA1:=IF(DEF>0,1,-1);
AA2:=REF(AA1,1);
AA3:=AA1*AA2;
AA4:=BARSLAST(AA3<0);
AA5:=AA4+1;
面積:SUM(DEF,AA5)/10,COLORGREEN,LINETHICK2;