ihzx 发表于 2021-8-21 14:01:58

大智慧混乱主图指标公式

<p>这个主图以神奇主图为主,其还包括了 BOLL、画线、三种背离等指标,大家觉的有用的可以看看。</p>
<p>input:N(13,1,100),N1(5,1,100);<br />
DRAWGBKLAST(CLOSE&gt;0,STRIP(RGB(95,95,95),RGB(0,0,0),0));<br />
{神升}<br />
操作: MA((LOW+HIGH+CLOSE)/3,5),COLORWHITE,LINETHICK2;<br />
支撑:LLV(操作,13),LINETHICK2,COLORBLUE;<br />
拉升:HHV(操作,13),COLORRED,LINETHICK2;<br />
庄压:HHV(MA(H,13),13),COLORYELLOW,LINETHICK2;<br />
{boll}<br />
MID :MA(CLOSE,18),POINTDOT,LINETHICK2;<br />
UPPERL: MID + 2*STD(CLOSE,18),POINTDOT,LINETHICK2,COLORGREEN;<br />
LOWERL: MID - 2*STD(CLOSE,18),POINTDOT,LINETHICK2,COLORRED;<br />
{画线}<br />
AA1:=ref(h,N1)=hhv(h,2*N1+1); BB1:=filter(AA1,N1); CC1:=backset(BB1,N1+1);<br />
DD1:=filter(CC1,N1);AA2:=ref(l,N1)=llv(l,2*N1+1); BB2:=filter(AA2,N1);<br />
CC2:=backset(BB2,N1+1); DD2:=filter(CC2,N1);<br />
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&gt;=EE2)) OR barstatus=2 OR barscount(c)=1;<br />
LL1:=(DD2 AND not(DD1 AND EE1&lt;EE2));HH2:=DD1 AND not(DD2 AND EE1&gt;=EE2);<br />
XX1:=ref(barslast(HH1),1)+1; FF1:=backset(HH1 AND count(LL1,XX1)&gt;0,llvbars<br />
(if(LL1,l,10000),XX1));GG1:=FF1&gt;ref(FF1,1); II1:=backset(GG1,2); LD1:=II1&gt;ref(II1,1);<br />
LL2:=LD1 OR barstatus=2 OR barscount(c)=1;<br />
XX2:=ref(barslast(LL2),1)+1; FF2:=backset(LL2 AND count(HH2,XX2)&gt;0,hhvbars<br />
(if(HH2,h,0),XX2));GG2:=FF2&gt;ref(FF2,1); II2:=backset(GG2,2); HD1:=II2&gt;ref(II2,1);<br />
RR1:=backset(barstatus=2,barslast(HD1)+1); SS1:=RR1&gt;ref(RR1,1);<br />
TT1:=backset(barstatus=2,barslast(LD1)+1); UU1:=TT1&gt;ref(TT1,1);<br />
RR2:=backset(SS1,ref(barslast(HD1),1)+2); SS2:=RR2&gt;ref(RR2,1);<br />
TT2:=backset(UU1,ref(barslast(LD1),1)+2); UU2:=TT2&gt;ref(TT2,1);<br />
TT3:=backset(UU2,ref(barslast(LD1),1)+2); UU3:=TT3&gt;ref(TT3,1);<br />
TT4:=backset(UU3,ref(barslast(LD1),1)+2); UU4:=TT4&gt;ref(TT4,1);<br />
RR3:=backset(SS2,ref(barslast(HD1),1)+2); SS3:=RR3&gt;ref(RR3,1);<br />
RR4:=backset(SS3,ref(barslast(HD1),1)+2); SS4:=RR4&gt;ref(RR4,1);<br />
短压5:drawline(SS2,h,SS1,h,1),Colorred,LINETHICK1;<br />
短支5:drawline(UU2,l,UU1,l,1),Colorgreen,LINETHICK1;<br />
中压5:drawline(SS3,h,SS2,h,1),Coloryellow,LINETHICK1;<br />
中支5:drawline(UU3,l,UU2,l,1),Colorgreen,LINETHICK1;   <br />
长压5:drawline(SS4,h,SS3,h,1),COLORwhite,LINETHICK1;<br />
长支5:drawline(UU4,l,UU3,l,1),Colorgreen,LINETHICK1;<br />
DRAWICON(SS1,H*1.01,10);DRAWICON(SS2,H*1.01,10); DRAWICON(SS3,H*1.01,10);<br />
DRAWICON(SS4,H*1.01,10);DRAWICON(UU1,L*0.99,9); DRAWICON(UU2,L*0.99,9);<br />
A1:=ref(h,N)=hhv(h,2*N+1); B1:=filter(A1,N); C1:=backset(B1,N+1);<br />
D1:=filter(C1,n);A2:=ref(l,N)=llv(l,2*N+1); B2:=filter(A2,N);<br />
C2:=backset(B2,N+1); D2:=filter(C2,N);<br />
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&gt;=E2)) OR barstatus=2 OR barscount(c)=1;<br />
L1:=(D2 AND not(D1 AND E1&lt;E2));H2:=D1 AND not(D2 AND E1&gt;=E2);<br />
X1:=ref(barslast(H1),1)+1; F1:=backset(H1 AND count(L1,X1)&gt;0,llvbars<br />
(if(L1,l,10000),X1));G1:=F1&gt;ref(F1,1); I1:=backset(G1,2); LD:=I1&gt;ref(I1,1);<br />
L2:=LD OR barstatus=2 OR barscount(c)=1;<br />
X2:=ref(barslast(L2),1)+1; F2:=backset(L2 AND count(H2,X2)&gt;0,hhvbars<br />
(if(H2,h,0),X2));G2:=F2&gt;ref(F2,1); I2:=backset(G2,2); HD:=I2&gt;ref(I2,1);<br />
R1:=backset(barstatus=2,barslast(HD)+1); S1:=R1&gt;ref(R1,1);<br />
T1:=backset(barstatus=2,barslast(LD)+1); U1:=T1&gt;ref(T1,1);<br />
R2:=backset(S1,ref(barslast(HD),1)+2); S2:=R2&gt;ref(R2,1);<br />
T2:=backset(U1,ref(barslast(LD),1)+2); U2:=T2&gt;ref(T2,1);<br />
T3:=backset(U2,ref(barslast(LD),1)+2); U3:=T3&gt;ref(T3,1);<br />
T4:=backset(U3,ref(barslast(LD),1)+2); U4:=T4&gt;ref(T4,1);<br />
R3:=backset(S2,ref(barslast(HD),1)+2); S3:=R3&gt;ref(R3,1);<br />
R4:=backset(S3,ref(barslast(HD),1)+2); S4:=R4&gt;ref(R4,1);<br />
短期压力:drawline(S2,h,S1,h,1),LINETHICK1,colormagenta;短期支撑:drawline(U2,l,U1,l,1),LINETHICK1,Colorgray;<br />
中期压力:drawline(S3,h,S2,h,1),LINETHICK1,colorbrown; 中期支撑:drawline(U3,l,U2,l,1),LINETHICK1,Colorgray;   <br />
长期压力:drawline(S4,h,S3,h,1),LINETHICK1,colorffff00;长期支撑:drawline(U4,l,U3,l,1),LINETHICK1,Colorgray;<br />
DRAWICON(S1,H*1.01,10);DRAWICON(S2,H*1.01,10); DRAWICON(S3,H*1.01,10);<br />
DRAWICON(S4,H*1.01,10);DRAWICON(U1,L*0.99,9); DRAWICON(U2,L*0.99,9);<br />
{背离}<br />
DIFF:=EMA(CLOSE,12) - EMA(CLOSE,26);<br />
DEA:=EMA(DIFF,8);<br />
A1A:=BARSLAST(REF(CROSS(DIFF,DEA),1));<br />
B1A:=REF(C,A1A+1)&gt;C AND REF(DIFF,A1A+1)&lt;DIFF AND CROSS(DIFF,DEA);<br />
DRAWTEXT(IF(B1A&gt;0,1,0),L-0.1,'MACD底背'),COLORGREEN;<br />
RSV:=(CLOSE-LLV(LOW,9))/(HHV(HIGH,9)-LLV(LOW,9))*100;<br />
K:=SMA(RSV,3,1);<br />
D:=SMA(K,3,1);<br />
A2A:=BARSLAST(REF(CROSS(K,D),1));<br />
B2A:=REF(C,A2A+1)&gt;C AND REF(K,A2A+1)&lt;K AND CROSS(K,D);<br />
DRAWTEXT(IF(B2A&gt;0,1,0),L-0.25,'KDJ底背'),COLORYELLOW;<br />
LC:=REF(CLOSE,1);<br />
RSI1:=SMA(MAX(CLOSE-LC,0),6,1)/SMA(ABS(CLOSE-LC),6,1)*100;<br />
RSI2:=SMA(MAX(CLOSE-LC,0),12,1)/SMA(ABS(CLOSE-LC),12,1)*100;<br />
A3:=BARSLAST(REF(CROSS(RSI1,RSI2),1));<br />
B3:=REF(C,A3+1)&gt;C AND REF(RSI1,A3+1)&lt;RSI1 AND CROSS(RSI1,RSI2);<br />
DRAWTEXT(IF(B3&gt;0,1,0),L-0.4,'RSI底背'),COLORCYAN;<br />
C1A:=BARSLAST(REF(CROSS(DEA,DIFF),1));<br />
D1A:=REF(C,C1A+1)&lt;C AND REF(DIFF,C1A+1)&gt;DIFF AND CROSS(DEA,DIFF);<br />
DRAWTEXT(IF(D1A&gt;0,1,0),H+0.1,'MACD顶背'),COLORWHITE;<br />
C2A:=BARSLAST(REF(CROSS(D,K),1));<br />
D2A:=REF(C,C2A+1)&lt;C AND REF(K,C2A+1)&gt;K AND CROSS(D,K);<br />
DRAWTEXT(IF(D2A&gt;0,1,0),H+0.25,'KDJ顶背'),COLORWHITE;<br />
C3A:=BARSLAST(REF(CROSS(RSI2,RSI1),1));<br />
D3A:=REF(C,C3A+1)&lt;C AND REF(RSI1,C3A+1)&gt;RSI1 AND CROSS(RSI2,RSI1);<br />
DRAWTEXT(IF(D3A&gt;0,1,0),H+0.4,'RSI顶背'),COLORMAGENTA;</p>
<p></p>
<p>&nbsp;</p>
页: [1]
查看完整版本: 大智慧混乱主图指标公式