大智慧BOLLMACDRSIDKJ畫線三種背離指標公式
- 指標類別: 大智慧指標公式
- 授權方式: 免費版
- 指標評級: ★★★★★
- 指標分類: 趨勢
- 畫線方法: 主圖
- 日期:2019-12-30 來源:互聯網
大智慧BOLLMACDRSIDKJ畫線三種背離指標公式:
input:N(13,1,100),N1(5,1,100);
DRAWGBKLAST(CLOSE>0,STRIP(RGB(95,95,95),RGB(0,0,0),0));
{神升}
操作: MA((LOW+HIGH+CLOSE)/3,5),COLORWHITE,LINETHICK2;
支撐:LLV(操作,13),LINETHICK2,COLORBLUE;
拉升:HHV(操作,13),COLORRED,LINETHICK2;
莊壓:HHV(MA(H,13),13),COLORYELLOW,LINETHICK2;
{boll}
MID : MA(CLOSE,18),POINTDOT,LINETHICK2;
UPPERL: MID + 2*STD(CLOSE,18),POINTDOT,LINETHICK2,COLORGREEN;
LOWERL: MID - 2*STD(CLOSE,18),POINTDOT,LINETHICK2,COLORRED;
{畫線}
AA1:=ref(h,N1)=hhv(h,2*N1+1); BB1:=filter(AA1,N1); CC1:=backset(BB1,N1+1);
DD1:=filter(CC1,N1);AA2:=ref(l,N1)=llv(l,2*N1+1); BB2:=filter(AA2,N1);
CC2:=backset(BB2,N1+1); DD2:=filter(CC2,N1);
EE1:=(ref(llv(l,2*N1),1)+ref(hhv(h,2*N1),1))/2; EE2:=(h+l)/2;HH1:=(DD1 AND not(DD2 AND EE1>=EE2)) OR barstatus=2 OR barscount(c)=1;
LL1:=(DD2 AND not(DD1 AND EE1<EE2)); HH2:=DD1 AND not(DD2 AND EE1>=EE2);
XX1:=ref(barslast(HH1),1)+1; FF1:=backset(HH1 AND count(LL1,XX1)>0,llvbars
(if(LL1,l,10000),XX1));GG1:=FF1>ref(FF1,1); II1:=backset(GG1,2); LD1:=II1>ref(II1,1);
LL2:=LD1 OR barstatus=2 OR barscount(c)=1;
XX2:=ref(barslast(LL2),1)+1; FF2:=backset(LL2 AND count(HH2,XX2)>0,hhvbars
(if(HH2,h,0),XX2));GG2:=FF2>ref(FF2,1); II2:=backset(GG2,2); HD1:=II2>ref(II2,1);
RR1:=backset(barstatus=2,barslast(HD1)+1); SS1:=RR1>ref(RR1,1);
TT1:=backset(barstatus=2,barslast(LD1)+1); UU1:=TT1>ref(TT1,1);
RR2:=backset(SS1,ref(barslast(HD1),1)+2); SS2:=RR2>ref(RR2,1);
TT2:=backset(UU1,ref(barslast(LD1),1)+2); UU2:=TT2>ref(TT2,1);
TT3:=backset(UU2,ref(barslast(LD1),1)+2); UU3:=TT3>ref(TT3,1);
TT4:=backset(UU3,ref(barslast(LD1),1)+2); UU4:=TT4>ref(TT4,1);
RR3:=backset(SS2,ref(barslast(HD1),1)+2); SS3:=RR3>ref(RR3,1);
RR4:=backset(SS3,ref(barslast(HD1),1)+2); SS4:=RR4>ref(RR4,1);
短壓5:drawline(SS2,h,SS1,h,1),Colorred,LINETHICK1;
短支5:drawline(UU2,l,UU1,l,1),Colorgreen,LINETHICK1;
中壓5:drawline(SS3,h,SS2,h,1),Coloryellow,LINETHICK1;
中支5:drawline(UU3,l,UU2,l,1),Colorgreen,LINETHICK1;
長壓5:drawline(SS4,h,SS3,h,1),COLORwhite,LINETHICK1;
長支5:drawline(UU4,l,UU3,l,1),Colorgreen,LINETHICK1;
DRAWICON(SS1,H*1.01,10);DRAWICON(SS2,H*1.01,10); DRAWICON(SS3,H*1.01,10);
DRAWICON(SS4,H*1.01,10);DRAWICON(UU1,L*0.99,9); DRAWICON(UU2,L*0.99,9);
A1:=ref(h,N)=hhv(h,2*N+1); B1:=filter(A1,N); C1:=backset(B1,N+1);
D1:=filter(C1,n);A2:=ref(l,N)=llv(l,2*N+1); B2:=filter(A2,N);
C2:=backset(B2,N+1); D2:=filter(C2,N);
E1:=(ref(llv(l,2*N),1)+ref(hhv(h,2*N),1))/2; E2:=(h+l)/2;H1:=(D1 AND not(D2 AND E1>=E2)) OR barstatus=2 OR barscount(c)=1;
L1:=(D2 AND not(D1 AND E1<E2)); H2:=D1 AND not(D2 AND E1>=E2);
X1:=ref(barslast(H1),1)+1; F1:=backset(H1 AND count(L1,X1)>0,llvbars
(if(L1,l,10000),X1));G1:=F1>ref(F1,1); I1:=backset(G1,2); LD:=I1>ref(I1,1);
L2:=LD OR barstatus=2 OR barscount(c)=1;
X2:=ref(barslast(L2),1)+1; F2:=backset(L2 AND count(H2,X2)>0,hhvbars
(if(H2,h,0),X2));G2:=F2>ref(F2,1); I2:=backset(G2,2); HD:=I2>ref(I2,1);
R1:=backset(barstatus=2,barslast(HD)+1); S1:=R1>ref(R1,1);
T1:=backset(barstatus=2,barslast(LD)+1); U1:=T1>ref(T1,1);
R2:=backset(S1,ref(barslast(HD),1)+2); S2:=R2>ref(R2,1);
T2:=backset(U1,ref(barslast(LD),1)+2); U2:=T2>ref(T2,1);
T3:=backset(U2,ref(barslast(LD),1)+2); U3:=T3>ref(T3,1);
T4:=backset(U3,ref(barslast(LD),1)+2); U4:=T4>ref(T4,1);
R3:=backset(S2,ref(barslast(HD),1)+2); S3:=R3>ref(R3,1);
R4:=backset(S3,ref(barslast(HD),1)+2); S4:=R4>ref(R4,1);
短期壓力:drawline(S2,h,S1,h,1),LINETHICK1,colormagenta;短期支撐:drawline(U2,l,U1,l,1),LINETHICK1,Colorgray;
中期壓力:drawline(S3,h,S2,h,1),LINETHICK1,colorbrown; 中期支撐:drawline(U3,l,U2,l,1),LINETHICK1,Colorgray;
長期壓力:drawline(S4,h,S3,h,1),LINETHICK1,colorffff00;長期支撐:drawline(U4,l,U3,l,1),LINETHICK1,Colorgray;
DRAWICON(S1,H*1.01,10);DRAWICON(S2,H*1.01,10); DRAWICON(S3,H*1.01,10);
DRAWICON(S4,H*1.01,10);DRAWICON(U1,L*0.99,9); DRAWICON(U2,L*0.99,9);
{背離}
DIFF:=EMA(CLOSE,12) - EMA(CLOSE,26);
DEA:=EMA(DIFF,8);
A1A:=BARSLAST(REF(CROSS(DIFF,DEA),1));
B1A:=REF(C,A1A+1)>C AND REF(DIFF,A1A+1)<DIFF AND CROSS(DIFF,DEA);
DRAWTEXT(IF(B1A>0,1,0),L-0.1,'MACD底背'),COLORGREEN;
RSV:=(CLOSE-LLV(LOW,9))/(HHV(HIGH,9)-LLV(LOW,9))*100;
K:=SMA(RSV,3,1);
D:=SMA(K,3,1);
A2A:=BARSLAST(REF(CROSS(K,D),1));
B2A:=REF(C,A2A+1)>C AND REF(K,A2A+1)<K AND CROSS(K,D);
DRAWTEXT(IF(B2A>0,1,0),L-0.25,'KDJ底背'),COLORYELLOW;
LC:=REF(CLOSE,1);
RSI1:=SMA(MAX(CLOSE-LC,0),6,1)/SMA(ABS(CLOSE-LC),6,1)*100;
RSI2:=SMA(MAX(CLOSE-LC,0),12,1)/SMA(ABS(CLOSE-LC),12,1)*100;
A3:=BARSLAST(REF(CROSS(RSI1,RSI2),1));
B3:=REF(C,A3+1)>C AND REF(RSI1,A3+1)<RSI1 AND CROSS(RSI1,RSI2);
DRAWTEXT(IF(B3>0,1,0),L-0.4,'RSI底背'),COLORCYAN;
C1A:=BARSLAST(REF(CROSS(DEA,DIFF),1));
D1A:=REF(C,C1A+1)<C AND REF(DIFF,C1A+1)>DIFF AND CROSS(DEA,DIFF);
DRAWTEXT(IF(D1A>0,1,0),H+0.1,'MACD頂背'),COLORWHITE;
C2A:=BARSLAST(REF(CROSS(D,K),1));
D2A:=REF(C,C2A+1)<C AND REF(K,C2A+1)>K AND CROSS(D,K);
DRAWTEXT(IF(D2A>0,1,0),H+0.25,'KDJ頂背'),COLORWHITE;
C3A:=BARSLAST(REF(CROSS(RSI2,RSI1),1));
D3A:=REF(C,C3A+1)<C AND REF(RSI1,C3A+1)>RSI1 AND CROSS(RSI2,RSI1);
DRAWTEXT(IF(D3A>0,1,0),H+0.4,'RSI頂背'),COLORMAGENTA;
大智慧BOLLMACDRSIDKJ畫線三種背離指標公式實例圖解:
大智慧BOLLMACDRSIDKJ畫線三種背離指標公式