這個(gè)指標(biāo)集MACD的短中長(zhǎng)周期、支撐壓力、畫(huà)線、支撐壓力價(jià)以及其他輔助判斷。大彩帶為長(zhǎng)周期MACD,小彩帶為短周期MACD,線條為我們平時(shí)在用的MACD。短周期加入了頂背離和底背離的提示。另外有W底的提示及止跌的信號(hào)。這樣就很好地克服了傳統(tǒng)MACD的滯后性(你可以看短周期的),同時(shí)大周期可以讓我們看清大趨勢(shì)。源碼如下:
DIFF1:=EMA(CLOSE,12) - EMA(CLOSE,26);
DEA1:=EMA(DIFF1,9);
VARX2:=LLV(DEA1,43);
VARX3:=DEA1-(DIFF1-DEA1);
低點(diǎn)線:=IF(DIFF1<VARX2 AND DEA1=VARX2,MIN(HHV(VARX2,10),VARX3),VARX2);
VL:=REF(LOW,1);
VAR12:=(SMA(ABS(LOW-VL),13,1))/(SMA(MAX(LOW-VL,0),13,1))*100;
VAR14:=MA(VAR12,13);
VAR15:=LLV(LOW,34);
VAR18:=EMA(IF(LOW<=VAR15,VAR14,0),3);
VAR110:=SMA(SMA((CLOSE-LLV(LOW,55))/(HHV(HIGH,55)-LLV(LOW,55))*100,7,1),5,1);
VAR111:=SMA((CLOSE-LLV(LOW,55))/(HHV(HIGH,55)-LLV(LOW,55))*100,8,1)*15-VAR110*10.38;
T:=FILTER(IF(VAR111<=VAR110 AND VAR18>0,VAR18*8,0),5);
止跌:DRAWTEXT(T AND DIFF1<低點(diǎn)線,DIFF1*1.01,'止跌'),COLORYELLOW;
{大周期}
DIF55:=(EMA(CLOSE,55)-EMA(CLOSE,119))*0.55;
DEA55:=(EMA(DIF55,41));
DRAWBAND(DEA55,RGB(0,100,50),DIF55,RGB(155,50,50));
{小周期}
DIF3_6.5F:=(EMA(CLOSE,3)-(EMA(CLOSE,6)+EMA(CLOSE,7))/2);
DEA3_6.5F:=(EMA(DIF3_6.5F,3)+EMA(DIF3_6.5,2));
DRAWBAND(DEA3_6.5F,RGB(100,100,300),DIF3_6.5F,RGB(100,300,150));
AA:=REF(DIF3_6.5F,N)=HHV(DIF3_6.5F,2*N+1);
BB:=BACKSET(AA,N+1);
CC:=FILTER(BB,N) AND DIF3_6.5F=HHV(DIF3_6.5F,N+1);
A1:=BARSLAST(REF(CC,1));
頂背離:=REF(CLOSE,A1+1)<CLOSE AND REF(DIF3_6.5F,A1+1)>DIF3_6.5F AND CC;
DRAWTEXT(頂背離,DIF3_6.5F*1.2,'頂背離'),COLORGREEN;
DRAWLINE(CC,DIF3_6.5F,FILTER(頂背離>0,5),DIF3_6.5F,0),COLORWHITE,POINTDOT;
AA2:=REF(DIF3_6.5F,N)=LLV(DIF3_6.5F,2*N+1);
BB2:=BACKSET(AA2,N+1);
CC2:=FILTER(BB2,N) AND DIF3_6.5F=LLV(DIF3_6.5F,N+1);
A2:=BARSLAST(REF(CC2,1));
底背離:=REF(CLOSE,A2+1)>CLOSE AND REF(DIF3_6.5F,A2+1)<DIF3_6.5F AND CC2;
DRAWTEXT(底背離,DIF3_6.5F*1.2,'底背離'),COLORMAGENTA;
DRAWLINE(CC2,DIF3_6.5F,FILTER(底背離>0,5),DIF3_6.5F,0),COLORWHITE,POINTDOT;
{中周期}
DIFF: EMA(CLOSE,12) - EMA(CLOSE,26),COLORWHITE,LINETHICK2;
DEA:EMA(DIFF,9),COLORYELLOW,LINETHICK2;
MACD: 2*(DIFF-DEA),COLORSTICK;
{形態(tài)}
A:=IF(CROSS(0,DEA),1,0);
A11:=IF(DIFF<0 AND CROSS(DIFF,DEA),1,0);
SS:=IF(A,SUM(A11,0),0);
SSB:=HHV(SS,0);
SSS:=SUM(A11,0);
W底:=SSS-SSB=2 AND SSS>REF(SSS,1);
DRAWTEXT(W底,DIFF,'↖W底'),COLORYELLOW;
{畫(huà)趨勢(shì)線}
M:=INTPART(3*10/5);
A12:=REF(DIFF,M)=HHV(DIFF,2*M+1);
B12:=FILTER(A12,M);
C12:=BACKSET(B12,M+1);
D12:=FILTER(C12,M);{高點(diǎn)}
R112:=BACKSET(ISLASTBAR,BARSLAST(D12)+1); S112:=R112>REF(R112,1);
短壓:DRAWLINE(D12,DIFF,S112,DIFF,1),COLORFF9966;
M1:=INTPART(3*20/5);
A111:=REF(DIFF,M1)=HHV(DIFF,2*M1+1);
B111:=FILTER(A111,M1);
C111:=BACKSET(B111,M1+1);
D1:=FILTER(C111,M1);{高點(diǎn)}
R11:=BACKSET(ISLASTBAR,BARSLAST(D1)+1); S11:=R11>REF(R11,1);
長(zhǎng)壓:DRAWLINE(D1,DIFF,S11,DIFF,1),COLORFF99FF;
{支撐壓力}
綠線天:=BARSLAST(CROSS(DEA,DIFF));
紅線天:=BARSLAST(CROSS(DIFF,DEA));
壓力:REF(H,綠線天),NODRAW;
支撐:REF(O,紅線天),NODRAW;
{壓力支撐價(jià)}
YLZC:=IF(CLOSE=INDEXC,(INDEXC+INDEXH+INDEXL+INDEXO)/4,AMOUNT/(VOL+0.01)/100);
阻價(jià):=IF(CLOSE=INDEXC,YLZC+INDEXC-INDEXL,YLZC+(CLOSE-LOW));
支價(jià):=IF(CLOSE=INDEXC,INDEXL+INDEXC-YLZC,LOW+(CLOSE-YLZC));
今壓:REF(阻價(jià),1),LINETHICK0,COLORAA11BB,NODRAW;
今撐:REF(支價(jià),1),LINETHICK0,COLOR009900,NODRAW;
明壓:阻價(jià),LINETHICK0,NODRAW;
明撐:支價(jià),LINETHICK0,NODRAW;
{注意:參數(shù)N為 1 100 3 }
本站僅提供存儲(chǔ)服務(wù),所有內(nèi)容均由用戶發(fā)布,如發(fā)現(xiàn)有害或侵權(quán)內(nèi)容,請(qǐng)
點(diǎn)擊舉報(bào)。