短中长期压力支撑
input: N(5,1,100);
DRAWGBK(CLOSE>0,colorRGB(95,95,95),colorRGB(0,0,0),1);
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),Colorred;短期支撑:drawline(U2,l,U1,l,1),Colorgreen;
中期压力:drawline(S3,h,S2,h,1),Coloryellow; 中期支撑:drawline(U3,l,U2,l,0),Colorgreen;
长期压力:drawline(S4,h,S3,h,1),COLORFF00FF;长期支撑: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);
STICKLINE(C>=O,O,C,8,0),COLORRED;STICKLINE(C>=O,C,H,0,0),COLORRED;
STICKLINE(C>=O,L,O,0,0),COLORRED;STICKLINE(C<O,C,O,8,0),colorFFFF00;
STICKLINE(C<O,O,H,0,0),colorFFFF00;STICKLINE(C<O,L,C,0,0),colorFFFF00;
A1:=BARSLAST(ref(cross("macd.diff","macd.dea"),1));
B1:=ref(c,A1+1)>c and ref("macd.diff",A1+1)<"macd.diff" and cross("macd.diff","macd.dea");
DRAWTEXT(FILTER(B1>0,5),l-0.38,'MACD底背'),COLORGREEN;
A2:=BARSLAST(ref(cross("kdj.k","kdj.d"),1));
B2:=ref(c,A2+1)>c and ref("kdj.k",A2+1)<"kdj.k" and cross("kdj.k","kdj.d");
DRAWTEXT(FILTER(B2>0,5),l-0.39,'KDJ底背'),COLORYELLOW;
A3:=BARSLAST(ref(cross("RSI.RSI1","RSI.RSI2"),1));
B3:=ref(c,A3+1)>c and ref("RSI.RSI1",A3+1)<"RSI.RSI1" and cross("RSI.RSI1","RSI.RSI2");
DRAWTEXT(FILTER(B3>0,5),l,'RSI底背'),COLORCYAN;
C1:=BARSLAST(ref(cross("macd.dea","macd.diff"),1));
D1:=ref(c,C1+1)<c and ref("macd.diff",C1+1)>"macd.diff" and cross("macd.dea","macd.diff");
DRAWTEXT(FILTER(D1>0,5),h+0.08,'MACD顶背'),COLORwhite;
C2:=BARSLAST(ref(cross("kdj.d","kdj.k"),1));
D2:=ref(c,C2+1)<c and ref("kdj.k",C2+1)>"kdj.k" and cross("kdj.d","kdj.k");
DRAWTEXT(FILTER(D2>0,5),h+0.32,'KDJ顶背'),COLORwhite;
C3:=BARSLAST(ref(cross("RSI.RSI2","RSI.RSI1"),1));
D3:=ref(c,C3+1)<c and ref("RSI.RSI1",C3+1)>"RSI.RSI1" and cross("RSI.RSI2","RSI.RSI1");
DRAWTEXT(FILTER(D3>0,5),h+0.1,'RSI顶背'),COLORMAGENTA;
|