主图股价跌到粉线时一般都会出现B就是买入,但此时可能股价还会下跌,所以可观察副图"偏移"与"观察"是否金叉,如未金叉则放弃,如果同时出则买进,顶部道理同,在此声明,此指标为引用不是原创,请多包涵.
主图源码
{N:1,100,20。M:1,100,32。P1:1,100,80。P2:1,100,100}
VAR1:=(C+H+O+L)/4;
卖出:XMA(VAR1,N)*(1+P1/1000),COLORGREEN,LINETHICK2;
买入:XMA(VAR1,M)*(1-P2/1000),COLORMAGENTA,LINETHICK2;
幅度:100*(卖出-买入)/买入,NODRAW;
MA1:=MA(VAR1,3);
STICKLINE(卖出>LOW AND 卖出<HIGH,卖出,MAX(卖出,MAX(OPEN,CLOSE)),3,0),COLORGREEN;
STICKLINE(卖出>MIN(C,O) AND 卖出<MAX(C,O),卖出,MAX(OPEN,CLOSE),3,0),COLORGREEN;
STICKLINE(卖出>LOW AND 卖出<HIGH,卖出,HIGH,0,0),COLORGREEN;
STICKLINE(卖出<LOW,OPEN,CLOSE,3,0),COLORGREEN;
STICKLINE(卖出<LOW,HIGH,LOW,0,0),COLORGREEN;
STICKLINE(买入>LOW AND 买入<HIGH,买入,MIN(MIN(OPEN,CLOSE),买入),3,0),COLORMAGENTA;
STICKLINE(买入>MIN(C,O) AND 买入<MAX(C,O),买入,MIN(OPEN,CLOSE),3,0),COLORMAGENTA;
STICKLINE(买入>LOW AND 买入<HIGH,买入,LOW,0,0),COLORMAGENTA;
STICKLINE(买入>HIGH,OPEN,CLOSE,3,0),COLORMAGENTA;
STICKLINE(买入>HIGH,HIGH,LOW,0,0),COLORMAGENTA;
DRAWTEXT(CROSS(C,买入) OR (L<买入),LOW*0.95,'B'),COLORRED,LINETHICK2;
DRAWTEXT(CROSS(C,卖出) OR (H>卖出),HIGH*1.02,'S'),COLORGREEN;
QA:=REF(H,10)=HHV(H,2*10+1);
QB:=BACKSET(QA,10+1);
QC:=FILTER(QB,10) AND H=HHV(H,10+1);
QD:=BARSLAST(QC);
QE:=IF(QC,CURRBARSCOUNT,0);
QF:=IF(QD,REF(QE,QD),QE);
QG:=CONST(QF);
QH:=REF(QF,QD+1);
QW:=CONST(QH);
DRAWLINE(CURRBARSCOUNT=QW,H,CURRBARSCOUNT=QG,H,1),COLORYELLOW;
DRAWLINE(CURRBARSCOUNT=QW,H,ISLASTBAR,REF(H,QW-1),1),COLOR0099FF,POINTDOT;
DRAWLINE(CURRBARSCOUNT=QG,H,ISLASTBAR,REF(H,QG-1),1),COLOR0099FF,POINTDOT;
QM:=INTPART(3*8/5);
QR:=REF(H,QM)=HHV(H,2*QM+1);
QT:=FILTER(QR,QM);
QY:=BACKSET(QT,QM+1);
QU:=FILTER(QY,QM);
QI:=BACKSET(ISLASTBAR,BARSLAST(QU)+1);
QP:=QI>REF(QI,1);
DRAWLINE(QU,H,QP,H,1),COLORRED;
QA1:=REF(L,8)=LLV(L,2*8+1);
QB1:=BACKSET(QA1,8+1);
QC1:=FILTER(QB1,8) AND L=LLV(L,8+1);
QD1:=BARSLAST(QC1);
QE1:=IF(QC1,CURRBARSCOUNT,0);
QF1:=IF(QD1,REF(L,QD1),L);
QG1:=IF(QD1,REF(QE1,QD1),QE1);
QH1:=CONST(QG1);
QW1:=REF(QF1,QD1+1);
QM1:=REF(QG1,QD1+1);
QR1:=CONST(QM1);
DRAWLINE(CURRBARSCOUNT=QR1,L,CURRBARSCOUNT=QH1,L,1),COLORBLUE;
DRAWLINE(CURRBARSCOUNT=QH1,L,ISLASTBAR,REF(L,QH1-1),1),COLORWHITE,POINTDOT;
DRAWLINE(CURRBARSCOUNT=QR1,L,ISLASTBAR,REF(L,QR1-1),1),COLORWHITE,POINTDOT;
QT1:=REF(L,QM)=LLV(L,2*QM+1);
QY1:=FILTER(QT1,QM);
QU1:=BACKSET(QY1,QM+1);
QI1:=FILTER(QU1,QM);
QP1:=BACKSET(ISLASTBAR,BARSLAST(QI1)+1);
QJ1:=QP1>REF(QP1,1);
DRAWLINE(QI1,L,QJ1,L,1),COLORRED;
SR1:=REF(HIGH,10)=HHV(HIGH,2*10+1);
SR2:=FILTER(SR1,10);
SR3:=BACKSET(SR2,10+1);
HD:=FILTER(SR3,10);
前高:=REF(H,BARSLAST(HD));
DRAWICON(CROSS(C,前高),L-0.20,1);{突破前高的信号};
{副图源码}
VAR1:=MA(CLOSE,5);
VAR2:=MA(CLOSE,10);
VAR3:=MA(CLOSE,20);
VAR4:=MA(CLOSE,30);
VAR5:=MA(CLOSE,60);
F1:=VAR1>REF(VAR1,1);
F2:=VAR2>REF(VAR2,1);
F3:=VAR2>REF(VAR2,1);
F4:=VAR2>REF(VAR2,1);
F5:=VAR2>REF(VAR2,1);
X1:=EMA(C,7);
DRAWTEXT(FILTER(VAR3 AND VAR2 AND COUNT(X1<REF(X1,1),5)>2 AND X1>REF(X1,1),3),L-0.01,'★短进'),COLORFFFFFF;
LC:=REF(CLOSE,1);
RSI:=SMA(MAX(CLOSE-LC,0),6,1)/SMA(ABS(CLOSE-LC),6,1)*100;
DRAWTEXT(CROSS(75,RSI) , HIGH,'★ 快跑 '),COLOR00FF00;
B1:=REF(CLOSE,1);B2:=REF(CLOSE,2);B3:=REF(CLOSE,3);B4:=REF(CLOSE,4);
CMAX:=MAX(MAX(MAX(CLOSE,B1),B2),B3);CMIN:=MIN(MIN(MIN(CLOSE,B1),B2),B3);
STICKLINE(CLOSE=CMAX AND (B1>=B2 OR B1>=B3) OR B1=CMAX AND (B2=CMIN OR B3=CMIN) AND CLOSE>=B2 OR
B2=CMAX AND B3=CMIN AND CLOSE>=B1 OR B3=CMAX AND CLOSE>=B1 AND CLOSE>=B2,B1,CLOSE,4,0),COLOR000099;
STICKLINE(CLOSE=CMAX AND B1=CMIN,B2,CLOSE,4,0),COLOR00FF00;
STICKLINE(CLOSE=CMIN AND (B1<B2 OR B1<B3) OR B1=CMIN AND (B2=CMAX OR B3=CMAX) AND CLOSE<B2 OR
B2=CMIN AND B3=CMAX AND CLOSE<B1 OR B3=CMIN AND CLOSE<B1 AND CLOSE<B2,B1,CLOSE,4,0),COLOR009900;
STICKLINE(B1=CMAX AND CLOSE=CMIN,B2,CLOSE,4,0),COLOR009900;
STICKLINE(B1=CMIN AND CLOSE>=B2 OR (B2=CMIN AND B1<=B3 OR
B3=CMIN AND B1<=B2) AND B2<B4 AND CLOSE>=B1,B1,B2,4,0),COLORFFFF00;
STICKLINE(B1=CMAX AND CLOSE<B2 OR (B2=CMAX AND B1>B3 OR
B3=CMAX AND B1>B2) AND B2>=B4 AND CLOSE<B1,B1,B2,4,0),COLOR0000FF;
TY:=C;
A1:=REF(TY,10)=HHV(TY,2*10+1); VB1:=FILTER(A1,10); C1:=BACKSET(VB1,10+1); HD:=FILTER(C1,10);
A2:=REF(TY,10)=LLV(TY,2*10+1); VB2:=FILTER(A2,10); C2:=BACKSET(VB2,10+1); LD:=FILTER(C2,10);
A:=REF(C,BARSLAST(HD)); B:=REF(C,BARSLAST(LD));
T1:=BARSLAST(HD)<BARSLAST(LD) AND NOT(HD) ;
T2:=BARSLAST(HD)>BARSLAST(LD) AND NOT(LD);
波峰:=IF(T1,A,A) ,POINTDOT ,COLOR00FFFF;
STICKLINE(T1,A,A,4,0),COLORFF00FF;
波谷:=IF(T2,B,B),POINTDOT,COLOR80FF00;
STICKLINE(T2,B,B,4,0),COLOR80FF00;
VAR21:=LLV(LOW,10);
VAR31:=HHV(HIGH,25);
阶段卖出:=3.2,;
清仓卖出:=3.5,COLOR0088FF;
底部介入:=0.2;
重点关注:=0.5;
偏移:XMA(H,10);观察:MA(H,10);
DRAWICON(LONGCROSS(偏移,观察,1),L*0.9975,1) ;
DRAWICON(LONGCROSS(观察,偏移,1),H*1.0025,2) ;
|