这个主图以神奇主图为主,其还包括了 boll、画线、三种背离等指标,大家觉的有用的可以看看。
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;