大智慧以线取胜主图指标公式
2020/12/7 19:21:33
input:P1(3,0,30),P2(6,1,300),P3(18,1,300),P4(250,0,300), N(40,1,100);
k:=2;
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;{高低点出现在同一K线上时可作取舍}
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),Colorred;
短期支撑:drawline(U2,l,U1,l,1),Colorgreen;
中期压力:drawline(S3,h,S2,h,1),{Coloryellow}COLORMAGENTA;
中期支撑:drawline(U3,l,U2,l,0),Colorgreen;
长期压力:drawline(S4,h,S3,h,1),COLORwhite;
长期支撑:drawline(U4,l,U3,l,0),Colorgreen;
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);
DRAWICON(U3,L*0.99,9);
DRAWICON(U4,L*0.99,9);
{画直线}DRAWLINE(HIGH>=HHV(HIGH,13),HIGH,LOW<=LLV(LOW,13),LOW,1),colorffff00;;
{画直线}DRAWLINE(HIGH>=HHV(HIGH,35),HIGH,LOW<=LLV(LOW,35),LOW,1),COLORGREEN,linethick2;
N1:=p1;{原码 N1:=3;}
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;{高低点出现在同一K线上时可作取舍}
Hh1:=(Dd1 AND NOT(Dd2 AND Ee1>=Ee2)) OR DISPSTATUS=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);
LlD:=Ii1>REF(Ii1,1);{过滤后低点}
Ll2:=LlD OR DISPSTATUS=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);
HhD:=Ii2>REF(Ii2,1);{过滤后高点}
Rr1:=BACKSET(DISPSTATUS=2,BARSLAST(hHD)+1); Ss1:=Rr1>REF(Rr1,1); {前一高}
Tt1:=BACKSET(DISPSTATUS=2,BARSLAST(LlD)+1); Uu1:=Tt1>REF(Tt1,1); {前一低}
Rr2:=BACKSET(Ss1,REF(BARSLAST(HhD),1)+2); Ss2:=Rr2>REF(Rr2,1); {前二高}
Tt2:=BACKSET(Uu1,REF(BARSLAST(LlD),1)+2); uU2:=Tt2>REF(Tt2,1); {前二低}
Tt3:=BACKSET(Uu2,REF(BARSLAST(LlD),1)+2); uU3:=Tt3>REF(Tt3,1); {前三低}
Tt4:=BACKSET(Uu3,REF(BARSLAST(LlD),1)+2); uU4:=Tt4>REF(tT4,1); {前四低}
Rr3:=BACKSET(Ss2,REF(BARSLAST(HhD),1)+2); sS3:=Rr3>REF(Rr3,1); {前三高}
Rr4:=BACKSET(Ss3,REF(BARSLAST(HhD),1)+2); sS4:=Rr4>REF(Rr4,1); {前四高};
DRAWLINE(Ss2,H,Ss1,H,1),Colorred,linethick2; {★压力1:}
DRAWLINE(Uu2,L,Uu1,L,1),POINTDOT,Colorred,linethick2;{★支撑1:}
DRAWLINE(Ss3,H,sS2,H,1),Coloryellow,linethick2; {★压力2:}
DRAWLINE(Uu3,L,Uu2,L,1),POINTDOT,Coloryellow,linethick2;{★支撑2:}
DRAWLINE(Ss4,H,Ss3,H,1),COLORwhite;{★压力3:}
DRAWLINE(Uu4,L,Uu3,L,1),POINTDOT,COLORwhite,linethick2;{★支撑3:};
投股 票网 www.tou18 .cn
股市公式下载推荐