Macd指標(biāo)的背離分為是頂背離和底背離形態(tài),具體的源碼公式如下:
DIFF : EMA(CLOSE,12) - EMA(CLOSE,26);
DEA : EMA(DIFF,9);
MACD=2*(DIFF-DEA);
Zero : 0;
gj:=MAX(C,O);
STICKLINE(MACD>0 AND MACD>=REF(MACD,1),0,MACD,2,0),color0000ff;
STICKLINE(MACD>0 AND MACD
STICKLINE(MACD<0 AND MACD>=REF(MACD,1),0,MACD,2,0),colorff00ff;
STICKLINE(MACD<0 AND MACD
//底背離公式:
L4:=LLV(gj,4);
jl:=(HHV(diff,55)-LLV(diff,55))/5;
gt:=dea>REF(dea,1) AND REF(dea,1)
A1:=BARSLAST(REF(gt,1));
底背離:=REF(L4,A1+1)>CLOSE AND diff>REF(diff,A1+1) AND gt;
DRAWLINE(A1=0,DEA,底背離,REF(DEA,A1),0),colorred,LINETHICK2;
DRAWLINE(底背離,DEA,底背離,REF(DEA,A1),0),colorred,LINETHICK2;
DRAWTEXT(底背離,REF(DEA,A1)*1.18,' 底背離'),COLORFF00FF;
//頂背離公式
H4:=HHV(gj,4);
gt2:=deaREF(dea,2);
A2:=BARSLAST(REF(gt2,1));
頂背離:= REF(H4,A2+1)
DRAWLINE(A2=0 ,DEA,頂背離,REF(DEA,A2),0),colorgreen,LINETHICK2;
DRAWLINE(頂背離,DEA,頂背離,REF(DEA,A2),0),colorgreen,LINETHICK2;
DRAWTEXT(頂背離,REF(DEA,A2)*1.18,' 頂背離'),colorgreen;
A0:=DIFF<0 AND DEA<0;
A11:=A0>REF(A0,1);
A3:=BARSLAST(A11);
A4:=COUNT(DEA>0 AND DIFF >0,A3)=0;
A5:=CROSS(DIFF ,DEA);
A6:=BARSLAST(A5);
A7:=REF(A6,A6+1)+A6;
A8:=(DIFF+DEA)/2;
A9:=(HIGH+LOW)/2;
A10:=A5 AND A7REF(A8,A7) AND A90;
DRAWTEXT(A10,DIFF*0.95,'★金叉買入'),coloryellow;
從以上的指標(biāo)公式中,我們可以看出macd指標(biāo)具有的兩條線diff與dea線的操作作用,與股價結(jié)合形成的有底背離的形態(tài)與頂背離的形態(tài),還有就是形成的金叉買入形態(tài),都是投資者在股市操作中的重要信號。
如果是將macd底背離的源碼導(dǎo)入軟件中,形成的走勢如下:
將如下的頂背離公式源碼導(dǎo)入軟件中顯示:
H4:=HHV(gj,4);
gt2:=deaREF(dea,2);
A2:=BARSLAST(REF(gt2,1));
頂背離:= REF(H4,A2+1)
DRAWLINE(A2=0 ,DEA,頂背離,REF(DEA,A2),0),colorgreen,LINETHICK2;
DRAWLINE(頂背離,DEA,頂背離,REF(DEA,A2),0),colorgreen,LINETHICK2;
DRAWTEXT(頂背離,REF(DEA,A2)*1.18,' 頂背離'),colorgreen;
同理將macd金叉形態(tài)的指標(biāo)源碼導(dǎo)入,出現(xiàn)的走勢圖形如下,而且金叉的走勢形態(tài)是買入的基本形態(tài),投資者在使用中注意把握機(jī)會。
以上就是本文講解的關(guān)于macd指標(biāo)變色背離的指標(biāo)源碼以及形成金叉走勢的源碼解析,如果您還想要了解更多的股票公式,請關(guān)注贏家財富網(wǎng),我們會為您提供更加專業(yè)的源碼公式講解和說明。
服務(wù)中心:鄭州市金水區(qū)農(nóng)業(yè)路經(jīng)三路
郵編:450002 網(wǎng)址:riverjudephoenix.com
銷售熱線:0371-65350319
技術(shù)支持:13333833889