主图是趋势指标,副图是波段类指标。
分享一下一个炒股老师傅给的一个主图指标及一个副图指标,都是用来做波段的
公式用法:
波段买卖指标的使用方法:K线变红,并且下方的两条槽出现红色和紫色出现就是买点;
K线变绿,或者下方的红色槽消失,卖点出现!红色槽跟紫色槽都不在,空仓状态!( 顶尖 财经 股票学院: )
{波段买卖}
P1:=10;P2:=30;
MAR1:=MA(CLOSE,P1);
C1:=C>=MAR1;
C2:=C
BB:=C2>C1 ;
STICKLINE(AA,C,O,3,0),COLORRED;
STICKLINE(AA,H,L,0,0),COLORRED;
STICKLINE(BB,C,O,3,0),COLOR00FF00;
STICKLINE(BB,H,L,0,0),COLOR00FF00;
STICKLINE(AA,CLOSE,OPEN,3,0),COLOR000099;
STICKLINE(AA,CLOSE,OPEN,2.2,0),COLOR0000CC;
STICKLINE(AA,CLOSE,OPEN,1.5,0),COLOR0000FF;
STICKLINE(AA,CLOSE,OPEN,0.5,0),COLORCC66FF;
STICKLINE(BB,CLOSE,OPEN,3,0),COLORFF7700;
STICKLINE(BB,CLOSE,OPEN,2.2,0),COLORFF9900;
STICKLINE(BB,CLOSE,OPEN,1.5,0),COLORFFBB00;
STICKLINE(BB,CLOSE,OPEN,0.5,0),COLORCYAN;
MAA:MAR1,COLOR00FF00,LINETHICK2;
IF(MAA>=REF(MAA,1),MAA,DRAWNULL),COLORRED,,LINETHICK2;
IF(MAAMAB:MA(CLOSE,P2),COLOR00FF00,LINETHICK2;
IF(MAB>=REF(MAB,1),MAB,DRAWNULL),COLORMAGENTA,LINETHICK2;
IF(MABDRAWICON(MAA>=REF(MAA,1) AND CROSS(MAA,MAB),MAA*0.98,1);
DRAWICON(CROSS(MAB,MAA),MAB*1.02,2);
VAR2:=(2*CLOSE+HIGH+LOW)/4;
VAR3:=IF(YEAR>=2099 AND MONTH>2,0,1);
VAR4:=LLV(LOW,5);
VAR5:=HHV(HIGH,4);
VAR6:=EMA((VAR2-VAR4)/(VAR5-VAR4)*100,4)*VAR3;
VAR7:=EMA(0.667*REF(VAR6,1)+0.333* VAR6,2)*VAR3;
DRAWTEXT(CROSS(VAR6, VAR7) AND VAR6<30,L-0.05,'←低吸'),COLOR00FFFF;
DRAWTEXT(CROSS(VAR7, VAR6) AND VAR6>70,H+0.05,'←高抛'),COLOR00FFFF;
DRAWICON(CROSS(VAR6, VAR7) AND VAR6<30,L-0.05,13);
DRAWICON(CROSS(VAR7, VAR6) AND VAR6>70,H+0.05,14);
AAA:= MAA>=REF(MAA,1);{C>=MAA;}
BBB:= MAADDD:=MAB>=REF(MAB,1);
EEE:=MABTT:=IF(ISLASTBAR,240/FROMOPEN,1);
NN:=120;
HH:=HHV(V*TT,NN);
LL:=LLV(V,NN);
最高:=CONST(HH);
最低:=CONST(LL);
最高2:=CONST(HHV(H,NN));
最低2:=CONST(LLV(L,NN));
PP:=IF((最高2*0.9-(最高2-最低2)*0.5)>CONST(LLV(L,20)),0.9,IF((最高2*0.9-(最高2-最低2)*0.5)>CONST(LLV(L,50)),0.7,0.6)),NODRAW;
RCC1:=最高2*0.9-(最高2-最低2)*PP;
最低3:=MIN(RCC1,最低2);
AA1:=最低3;
STICKLINE(AAA,AA1-0.000*AA1,AA1-0.040*AA1,4,0),COLOR0000FF;
STICKLINE(BBB,AA1-0.000*AA1,AA1-0.040*AA1,4,1),COLOR686868;
STICKLINE(DDD,AA1-0.050*AA1,AA1-0.090*AA1,4,0),COLORFF00FF;
STICKLINE(EEE,AA1-0.050*AA1,AA1-0.090*AA1,4,1),COLOR686868;
DRAWTEXT_FIX(1,0.5,0.84,0,'★★ 红色--均线A持股★★粉色--均线B持股★★'),COLOR00FFFF;
{多空买卖}
VAR1:=(CLOSE+HIGH+LOW+OPEN)/4;
VAR2:=SUMBARS(VOL,CAPITAL);
VAR3:=HHV(VAR1,VAR2);
VAR4:=LLV(VAR1,VAR2);
VAR5:=(2*VAR1-VAR4-REF(VAR4,1))/(VAR3-VAR4);
VAR6:=(VAR1-VAR4)/(VAR3-VAR4);
VAR7:=IF(VAR1<=VAR4,VAR5*60,VAR6*60);
VAR8:=600*(EMA(CLOSE,3)-EMA(LOW,30))/EMA(LOW,30);
VAR9:=EMA(VAR8,7);
VARA:=(WINNER(120*CLOSE/100)-WINNER(100*CLOSE/100))*100;
VARB:=(-100)*(WINNER(120*CLOSE/100)-WINNER(100*CLOSE/100))+5;
波段买入: IF(VARA+VARB<7 AND CROSS(VAR8,VAR9) AND VAR9<-18 AND VAR9
VARC:=HHV(HIGH,9)-LLV(LOW,9);
VARD:=HHV(HIGH,9)-CLOSE;
VARE:=CLOSE-LLV(LOW,9);
VARF:=VARD/VARC*100-70;
VAR10:=(CLOSE-LLV(LOW,60))/(HHV(HIGH,60)-LLV(LOW,60))*100;
VAR11:=(2*CLOSE+HIGH+LOW)/4;
VAR12:=SMA(VARE/VARC*100,3,1);
VAR13:=LLV(LOW,34);
VAR14:=SMA(VAR12,3,1)-SMA(VARF,9,1);
VAR15:=IF(VAR14>100,VAR14-100,0);
VAR16:=HHV(HIGH,34);
VAR17:EMA((VAR11-VAR13)/(VAR16-VAR13)*100,8);
巫修全制: VAR17,COLORYELLOW ;
VAR18:=EMA(VAR17,5);
STICKLINE(VAR17>0 AND VAR17-VAR18>=0,79,80,6,0),COLORRED ;
STICKLINE(VAR17>0 AND VAR17-VAR18<0,79,80,6,1),COLOR00FF00 ;
STICKLINE(VAR17>0 AND VAR17-VAR18>=0,19,20,6,0),COLORRED, ;
STICKLINE(VAR17>0 AND VAR17-VAR18<0,19,20,6,1),COLOR00FF00 ;
STICKLINE(VAR17-VAR18>0,VAR17,VAR18,8,1),COLORRED ;
STICKLINE(VAR17-VAR18<0,VAR17,VAR18,8,1),COLOR00FF00 ;
2、火焰山主力资金
{火焰山主力资金}
DRAWGBK(C>0, RGB(0,10,10),RGB(88,0,0),0,'11',0); YM:=MA(((WINNER((CLOSE * 0.9)) * 100) * CLOSE),3);
DC:=(IF((YM > 10),YM,0) / 2);
主力资金:DC,STICK,LINETHICK4,COLORRED;
资金均量:MA(DC,5),COLORGREEN;
资金流入线:DC,COLORYELLOW,LINETHICK1;
资金均量线:MA(DC,5),COLORMAGENTA;
盘1:=COST(0.33);
盘2:=COST(5);
盘3:=COST(15);
盘4:=COST(55);
盘5:=COST(97);
获利:=WINNER(CLOSE)*100;
套牢:=100-WINNER(CLOSE)*100;
DRAWTEXT_FIX(1,0.02,0,0,EXTERNSTR(0,1)),COLOR719FFF;
{DRAWTEXTABS(675,25,'升浪:'+NUMTOSTRN(盘4,2)),COLOR00FFFF;
DRAWTEXTABS(520,40,'获利:'+NUMTOSTRN(获利,2)+'%'),COLOR00FFFF;
DRAWTEXTABS(600,40,'套牢:'+NUMTOSTRN(套牢,2)+'%'),COLOR00FFFF;
DRAWTEXTABS(675,40,'预测:'+NUMTOSTRN(盘5,2)),COLOR00FFFF;}
MA1:=MA(CLOSE,5);
MA2:=MA(CLOSE,10);
MA3:=MA(CLOSE,20);
MA4:=MA(CLOSE,30);
多头排列:= MA1>MA2 AND MA2>MA3 AND MA3>MA4 ;
MA60:=MA(C,60),COLORFFCC66; MA13:=MA(C,13),COLORFFCC66;
MA75:=MA(C,75),COLORFFCC66;
空头排列:= MA1
下降成:=CONST(IF(下跌趋势 AND MA1上升成:=CONST(IF(上升趋势 AND REF(NOT(上升趋势),1),1,0));
DRAWTEXT_FIX(ISLASTBAR AND 下降成=1,0.8,0.2,0,'下降趋势成'),COLORFFFF00;
DRAWTEXT_FIX(ISLASTBAR AND 上升成=1,0.8,0.2,0,'上升趋势成'),COLOR8080FF;
一阴穿2线:=C/O<0.985 AND H>MA1 AND C
发散度:=MA1/MA4;
均线下发散:=下跌趋势 AND 发散度<0.9 AND 发散度<0.99*REF(发散度,1);
均线上发散:=MA1>REF(MA1,1) AND MA2>REF(MA2,1) AND MA3>REF(MA3,1) AND MA4>REF(MA4,1) AND MA1>MA2 AND MA2>MA3 AND MA3>MA4;
AAAA1:=MAX(MAX(MA(V,5),MA(V,10)),MA(V,60))/MIN(MIN(MA(V,5),MA(V,10)),MA(V,60))<=1.4;
AAAA2:=MAX(MA(C,5),MA(C,10))/MIN(MA(C,5),MA(C,10))<=1.4;
DIFF:=EMA(C,12)-EMA(C,26);
DEA:=EMA(DIFF,9);
MA5:=MA(CLOSE,5);
MA10:=MA(CLOSE,10);
MA20:=MA(CLOSE,20);
RSV:=(CLOSE-LLV(LOW,9))/(HHV(HIGH,9)-LLV(LOW,9))*100;
K:=SMA(RSV,3,1);
D:=SMA(K,3,1);
J:=3*K-2*D;
均线密集:=DIFF>DEA AND K >D AND(MA5-MA10)<0.05 AND (MA20-MA5)<0.05 AND (MA10-MA5)<0.05 AND (MA5-MA20)<0.05;
A:=MA(-100*(HHV(H,34)-C)/(HHV(H,34)-LLV(L,34)),19);
B:=-100*(HHV(H,14)-C)/(HHV(H,14)-LLV(L,14));
DD:=EMA(-100*(HHV(H,34)-C)/(HHV(H,34)-LLV(L,34)),4);
长线:=A+100;
短线:=B+100;
中线:=DD+100;
见顶:=(REF(中线,1)>85 AND REF(短线,1)>85 AND REF(长线,1)>65 AND CROSS(长线,短线));
顶区:=(中线 >REF(中线,1) AND REF(中线,1)>80 AND REF(短线,1)>95 OR REF(短线,2)>95
AND 长线>60 AND 短线<83.5 AND 短线<中线 AND 短线<长线+4);
底区:=长线<20 AND 中线<18 AND 短线<40 AND REF(短线,1)<5 AND 中线 >REF(中线,1)AND 短线 >REF(短线,1);
顶部:=FILTER(顶区,4);
{STICKLINE(见顶,H,(H+L)/2,3,0), ,COLORRED;
STICKLINE(顶部,H,(H+L)/2,3,0), ,COLORRED;}
VAR2N:=LLV(LOW,3)<=LLV(LOW,60);
VAR3N:= C>O AND (C/O>1.03 OR C>1.03*REF(C,1));
绝地反击:=IF(VAR2N AND VAR3N,90,0),COLORYELLOW,LINETHICK2;
LC := REF(CLOSE,1);
RSI1:=SMA(MAX(CLOSE-LC,0),6,1)/SMA(ABS(CLOSE-LC),6,1)*100;
A1:=SMA(MAX(C-LC,0),6,1);
B1:=SMA(ABS(C-LC),6,1);
界:=IF(C>LC,(REF(A1,1)*5-REF(B1,1)*5*0.5)/(0.5-1)+LC,LC+REF(B1,1)*5-REF(A1,1)*5/0.5),COLORWHITE;
MACD:=4*(DIFF-DEA);
{STICKLINE(MACD>0,中轴,中轴+MACD,0,1),COLORRED;
STICKLINE(MACD<0,中轴,中轴+MACD,0,1),COLORLIBLUE;
STICKLINE(MACD0,中轴,中轴+MACD,0,0 ),COLOR00BBFF;
STICKLINE(MACD>=REF(MACD,1)AND MACD>0,中轴,中轴+MACD,0,0 ),COLOR0011BB;
STICKLINE(MACD>REF(MACD,1)AND MACD<0,中轴,中轴+MACD,0,0),COLORBB11BB;
STICKLINE(MACD<=REF(MACD,1)AND MACD<0,中轴,中轴+MACD,0,0),COLORFFBB11;}
缩头:=IF(MACD>0 AND REF(MACD,1)>REF(MACD,2) AND MACD< REF(MACD,1),1,0);
缩脚:=IF(MACD<0 AND REF(MACD,1)< REF(MACD,2) AND MACD>REF(MACD,1),1,0);
{ DRAWICON( 缩脚,(中轴+MACD)-0.1,1),COLOR00FF00;
DRAWICON(FILTER(缩头,3) AND 缩头,(中轴+MACD)+0.1,2),COLORFF00FF;
SAT:=(AMOUNT/C)/(HHV(AMOUNT,20)/HHV(C,20))*100,COLORRED;
DRAWICON(SAT>=100 AND MACD>0,(中轴+MACD)+0.2,12);}
ZDIF:=EMA(INDEXC,12)-EMA(INDEXC,26);
ZHIDEA:=EMA(ZDIF,9);
ZEMACD:=(ZDIF-ZHIDEA)*2/100,COLORSTICK;DK:=ZEMACD;
{STICKLINE(DK0,RC,RC+DK,0,0 ),COLOR00BBFF;
STICKLINE(DK>=REF(DK,1)AND DK>0,RC,RC+DK,0,0 ),COLOR0011BB;
STICKLINE(DK>REF(DK,1)AND DK<0,RC,RC+DK,0,0),COLORBB11BB;
STICKLINE(DK<=REF(DK,1)AND DK<0,RC,RC+DK,0,0),COLORFFBB11;}
Z缩头:=IF(DK>0 AND REF(DK,1)>REF(DK,2) AND DK< REF(DK,1),1,0);
Z缩脚:=IF(DK<0 AND REF(DK,1)< REF(DK,2) AND DK>REF(DK,1),1,0);
{ DRAWICON( Z缩脚,(RC+DK)-0.1,1),COLOR00FF00;
DRAWICON(FILTER(Z缩头,3) AND Z缩头,(RC+DK)+0.1,2),COLORFF00FF; }
TT:=240/FROMOPEN;
比:=TT;
J12:=(HIGH - ((HIGH - LOW) / 3));
J23:=(LOW + ((HIGH - LOW) / 3));
AAA1:=CONST(HHV(H,90));
BBB:=CONST(LLV(L,30))+2;
T1:=CONST(IF(CLOSE>界,1,0));
T2:=CONST(IF(CLOSE<界,1,0));
T3:=CONST(IF(C
T5:=CONST(IF(CROSS(MA(CLOSE,13),CLOSE),1,0));
T6:=CONST(IF(C>=MA(C,5) AND C
VAR1Y:=VOL/CAPITAL*100;
VAR2Y:=LLVBARS(LOW,10);
VAR3Y:=(CLOSE-REF(OPEN,VAR2Y))/REF(OPEN,VAR2Y)*100;
VAR4Y:=REF(CLOSE,2)*0.865;
VAR5Y:=REF(CLOSE,13)*0.772;
VAR6Y:=MAX(VAR4Y,VAR5Y);
T9:=(CLOSE-VAR6Y)/CLOSE>0.2 AND VAR3Y<50 AND SUM(VAR1Y,5)/5>5;
T10:=CONST(IF(VAR2N AND VAR3N,1,0));
T11:=CONST(IF(缩脚,1,0));
T12:=CONST(IF( ZDIF<0 ,1,0));
T14:=CONST(IF(ZEMACD>=REF(ZEMACD,1) AND ZEMACD>0 AND ZDIF>=0 ,1,0));
LC1:=REF(INDEXC,1);
ZRSI:=SMA(MAX(INDEXC-LC1,0),6,1)/SMA(ABS(INDEXC-LC1),6,1)*100,COLORD9D900;
X:=INDEXC;
Y:=INDEXO;
Z:=INDEXL;
I:=INDEXH;
急速超跌:=(X-MA(X,34))/MA(X,34)*100<-5;
当日收阳:=(I-Z)/Z>0.01 AND (X-Y)/Y>0.01 AND X/REF(X,1)>1.01;
超跌收阳:=CONST(IF(急速超跌 AND 当日收阳,1,0));
DRAWTEXT_FIX(ISLASTBAR AND 超跌收阳=1 ,0.65,0.5,0,'大盘短底,少量买'),COLOR8080FF;
A1W:=SMA(MAX(X-LC1,0),6,1);
B1W:=SMA(ABS(X-LC1),6,1);
界1:=IF(X>LC1,(REF(A1W,1)*5-REF(B1W,1)*5*0.5)/(0.5-1)+LC1,LC1+REF(B1W,1)*5-REF(A1W,1)*5/0.5),COLORWHITE;
TYP := (Z +I + X)/3;
YY:=(TYP-MA(TYP,14))/(0.015*AVEDEV(TYP,14)),LINETHICK0;
BB:=(TYP-MA(TYP,14))/(0.015*AVEDEV(TYP,14));
超卖:=CONST(IF(CROSS(BB,-200),1,0));
DRAWTEXT_FIX(ISLASTBAR AND 超卖=1 ,0.65,0.5,0,'大盘超卖,少量买'),COLOR8080FF;
KS:=(C-MA(C,17))/MA(C,17)*(-100);
RKS:=REF(KS,1);
MLS:=RKS/KS>=1.23 AND RKS>=8 AND C/REF(C,1)>=1.01;
大盘4:=CONST(IF(X>界1,1,0));
大盘3:=CONST(IF(X<界1,1,0));
大盘12{M13}:=CONST(IF(ZEMACD>REF(ZEMACD,1) AND ZEMACD>0 AND ZDIF<0 ,1,0));
大盘13:=CONST(IF(ZEMACD<0 AND ZDIF>0 ,1,0));
M整理:=CONST(IF( MACD<0 AND DIFF>0,1,0));
M走缓:=CONST(IF(MACD0 AND DIFF>0 ,1,0));
大盘16:=CONST(IF(ZEMACD0 ,1,0));
大盘11:=CONST(IF(KS>=17 ,1,0));
大盘2:=CONST(IF(MLS=1,1,0));
M弹:=CONST(IF(MACD>REF(MACD,1) AND MACD>0 AND DIFF<0,1,0));
{DRAWTEXT_FIX(大盘12=1 AND ISLASTBAR,0.3,0.5,0,'大盘下降趋势,反弹,谨慎'),COLORWHITE ;}
DRAWTEXT_FIX(大盘12 AND ISLASTBAR,0.5,0.5,0,'处于反弹区'),COLOR8080FF;
DRAWTEXT_FIX(M弹=1 AND ISLASTBAR,0.26,0.35,0,'反弹阶段小心'),COLORYELLOW;
MM3:=CONST(IF(RSI1
WJ:=(H+L+C)/3;
V1:=IF(H=L,1,H-MAX(O,C));
V2:=IF(H=L,1,MAX(C,O)-WJ);
V3:=IF(H=L,1,MIN(O,C)-L);
V4:=IF(H=L,1,WJ-MIN(C,O));
V5:=VOL/IF(H=L,4,H-L);
V6:=(V1*V5);
V7:=(V2*V5);
V8:=(V3*V5);
V9:=(V4*V5);
买盘1:=DYNAINFO(23)*比;
卖盘1:=DYNAINFO(22)*比;
买盘2:=IF(ISLASTBAR AND C>300,(V9+V8)*TT,(V9+V8));
卖盘2:=IF(ISLASTBAR AND C>300,(V6+V7)*TT,(V6+V7));
买盘:=IF(ISLASTBAR AND PERIOD=5 AND C<300,买盘1,买盘2);
卖盘:=IF(ISLASTBAR AND PERIOD=5 AND C<300,卖盘1,卖盘2);MFI:=(HIGH-LOW)*1000000/(VOL*比);
绿灯:=MFI>=REF(MFI,1)AND VOL*比>=REF(VOL,1);
M1:=CONST(IF(空头排列 AND 均线下发散,1,0));
M2:=CONST(IF(多头排列 AND 均线上发散,1,0));
M3:=CONST(IF(空头排列 AND NOT(均线下发散),1,0));
M9:=CONST(IF(空头排列 ,1,0));
M10:=CONST(IF(多头排列 ,1,0));
MM1:=CONST(IF(均线密集,1,0));
MM2:=CONST(IF(上升趋势 AND NOT(一阴穿2线) AND REF(上升趋势,1),1,0));
M4:=CONST(IF(下跌趋势 AND NOT(一阳穿2线),1,0));
MM5:=CONST(IF(DIFF<0 AND MACD<0 AND MACD>REF(MACD,1),1,0));
MM7:=CONST(IF(ZEMACD>REF(ZEMACD,1) AND ZEMACD<0,1,0));
MM8:=CONST(IF(下跌趋势 AND REF(下跌趋势,1) AND NOT(一阳穿2线),1,0));
MM9:=CONST(IF(ZEMACD0,1,0));
量大:=(卖盘+买盘)/REF(VOL,1)>2;
M5:=CONST(量大);
量缩:=REF(VOL,1)/(卖盘+买盘)>1.5;
M6:=CONST(量缩);
卖量大:=(卖盘-买盘)/买盘>0.4;
M7:=CONST(卖量大);
买量大:=(买盘-卖盘)/卖盘>0.4;
M8:=CONST(买量大);
{DRAWTEXT(VAR2N AND VAR3N,L*0.99,'反击'),COLOR00FF00;}
BIAS1:=(C-MA(C,6))/MA(C,6)*100;
BIAS2:=(C-MA(C,12))/MA(C,12)*100;
BIAS3:=(C-MA(C,24))/MA(C,24)*100;
BIAS:=(BIAS1+2*BIAS2+3*BIAS3)/6;
乖离:=MA(BIAS,3);
乖:=CONST(IF(CROSS(BIAS,乖离) AND 乖离<-9,1,0)),COLOR00FFFF;
DRAWTEXT_FIX(ISLASTBAR AND 乖=1,0.65,0.35,0,'乖离买点'),COLOR8080FF;
坑:=CONST(IF( 乖离<-19,1,0)),COLORRED;
DRAWTEXT_FIX(ISLASTBAR AND 坑=1,0.65,0.5,0,'深坑买点'),COLOR8080FF;
3、MACD背离钝化
MACD背离钝化( 顶尖 财经 股票学院: )
MACD背离钝化
DIFF:EMA(CLOSE,9) - EMA(CLOSE,26),COLORWHITE;
DEA:EMA(DIFF,12),COLORYELLOW;
MACD=2*(DIFF-DEA);
ZERO : 0;
GJ:=MAX(C,O);
L4:=LLV(GJ,4);
JL:=(HHV(DIFF,55)-LLV(DIFF,55))/5;
GT:=DEA>REF(DEA,1) AND REF(DEA,1)
A1:=BARSLAST(REF(GT,1));
STICKLINE(MACD>0 AND MACD>=REF(MACD,1),0,MACD,2,0),COLOR0000FF;
STICKLINE(MACD>0 AND MACD
STICKLINE(MACD<0 AND MACD>=REF(MACD,1),0,MACD,2,0),COLORFF00FF;
STICKLINE(MACD<0 AND MACD
底背离:=REF(L4,A1+1)>CLOSE AND DIFF>REF(DIFF,A1+1) AND GT;
DRAWLINE(A1=0,DEA,底背离,REF(DEA,A1),0),COLORRED,LINETHICK2;
DRAWLINE(底背离,DEA,底背离,REF(DEA,A1),0),COLORRED,LINETHICK2;
DRAWTEXT(底背离,REF(DEA,A1)*1.18,' 底背离'),COLORFF00FF;
H4:=HHV(GJ,4);
GT2:=DEAREF(DEA,2);
A2:=BARSLAST(REF(GT2,1));
顶背离:= REF(H4,A2+1)
DRAWLINE(A2=0 ,DEA,顶背离,REF(DEA,A2),0),COLORGREEN,LINETHICK2;
DRAWLINE(顶背离,DEA,顶背离,REF(DEA,A2),0),COLORGREEN,LINETHICK2;
DRAWTEXT(顶背离,REF(DEA,A2)*1.18,' 顶背离'),COLORGREEN;
死叉:=CROSS(DEA,DIFF);
DRAWICON(死叉,DIFF*0.95,'2');
N1:BARSLAST(死叉),NODRAW;
N2:REF(BARSLAST(死叉),N1+1),NODRAW;
N3:REF(BARSLAST(死叉),N2+N1+2),NODRAW;
CL1:=LLV(C,N1+1),NODRAW;
DIFL1:=LLV(DIFF,N1+1),NODRAW;
CL2:=REF(CL1,N1+1),NODRAW;
DIFL2:=REF(DIFL1,N1+1),NODRAW;
CL3:=REF(CL2,N1+1),NODRAW;
DIFL3:=REF(DIFL2,N1+1),NODRAW;
PDIFL2:=IF(DIFL2>0,INTPART(LOG(DIFL2))-1,INTPART(LOG(-DIFL2))-1);
MDIFL2:=INTPART(DIFL2/POW(10,PDIFL2));
PDIFL3:=IF(DIFL3>0,INTPART(LOG(DIFL3))-1,INTPART(LOG(-DIFL3))-1);
MDIFL3:=INTPART(DIFL3/POW(10,PDIFL3));
MDIFB2:=INTPART(DIFF/POW(10,PDIFL2));
MDIFB3:=INTPART(DIFF/POW(10,PDIFL3));
直接底背离:=(CL1MDIFL2) AND (MACD<0 AND REF(MACD,1)<0) AND MDIFB2<=REF(MDIFB2,1);
隔峰底背离:=(CL1MDIFL3) AND (MACD<0 AND REF(MACD,1)<0) AND MDIFB3<=REF(MDIFB3,1);
B:直接底背离 OR 隔峰底背离,NODRAW;
BG:((MDIFB2>REF(MDIFB2,1))*REF(直接底背离,1)) OR ((MDIFB3>REF(MDIFB3,1))*REF(隔峰底背离,1)),NODRAW;
底背离消失:=(REF(直接底背离,1) AND DIFL1<=DIFL2 ) OR (REF(隔峰底背离,1) AND DIFL1<=DIFL3);
STICKLINE(B OR BG,DIFF,DEA,8,0),COLORRED,LINETHICK2;
DRAWTEXT((B AND COUNT(B,2)=1),(DIFF*1.5),'钝'),COLORYELLOW;
DRAWTEXT(FILTER(BG,10),DIFF*1.5,'成'),COLORMAGENTA;
DRAWTEXT(FILTER(底背离消失,10),(DIFF+MACD),'失'),COLORGREEN;
STICKLINE(BG,0,DIFF+DEA,5,0),COLORRED,LINETHICK3;
金叉:=CROSS(DIFF,DEA);
DRAWICON(金叉,DIFF*0.95,'1');
M1:=BARSLAST(金叉),NODRAW;
M2:=REF(BARSLAST(金叉),M1+1);
M3:=REF(BARSLAST(金叉),M2+M1+2);
CH1:=HHV(C,M1+1),NODRAW;
DIFH1:=HHV(DIFF,M1+1),NODRAW;
CH2:=REF(CH1,M1+1),NODRAW;
DIFH2:=REF(DIFH1,M1+1),NODRAW;
CH3:=REF(CH2,M1+1),NODRAW;
DIFH3:=REF(DIFH2,M1+1),NODRAW;
PDIFH2:=IF(DIFH2>0,INTPART(LOG(DIFH2))-1,INTPART(LOG(-DIFH2))-1);
MDIFH2:=INTPART(DIFH2/POW(10,PDIFH2));
PDIFH3:=IF(DIFH3>0,INTPART(LOG(DIFH3))-1,INTPART(LOG(-DIFH3))-1);
MDIFH3:=INTPART(DIFH3/POW(10,PDIFH3));
MDIFT2:=INTPART(DIFF/POW(10,PDIFH2));
MDIFT3:=INTPART(DIFF/POW(10,PDIFH3));
直接顶背离:=(CH1>CH2 ) AND (MDIFT20 AND REF(MACD,1)>0) AND MDIFT2>=REF(MDIFT2,1);
隔峰顶背离:=(CH1>CH3 AND CH3>CH2 ) AND (MDIFT30 AND REF(MACD,1)>0) AND MDIFT3>=REF(MDIFT3,1);
T:=直接顶背离 OR 隔峰顶背离,NODRAW;
TG:=((MDIFT2
顶背离消失:=(REF(直接顶背离,1) AND DIFH1>=DIFH2 ) OR (REF(隔峰顶背离,1) AND DIFH1>=DIFH3);
STICKLINE(TG,0,DIFF+DEA,5,0), COLORGREEN,LINETHICK4;
STICKLINE(T OR TG,DIFF,DEA,8,0),COLORGREEN,LINETHICK2;
DRAWTEXT(FILTER(TG,20),DIFF*1.4,'成'),COLORMAGENTA;
DRAWTEXT(FILTER(顶背离消失,20),(DIFF+MACD),'失'),COLORGREEN;
隔峰底背离:=(CL1
B:直接底背离 OR 隔峰底背离,NODRAW;
BG:((MDIFB2>REF(MDIFB2,1))*REF(直接底背离,1)) OR ((MDIFB3>REF(MDIFB3,1))*REF(隔峰底背离,1)),NODRAW;
底背离消失:=(REF(直接底背离,1) AND DIFL1<=DIFL2 ) OR (REF(隔峰底背离,1) AND DIFL1<=DIFL3);
STICKLINE(B OR BG,DIFF,DEA,8,0),COLORRED,LINETHICK2;
DRAWTEXT((B AND COUNT(B,2)=1),(DIFF*1.5),'钝'),COLORYELLOW;
DRAWTEXT(FILTER(BG,10),DIFF*1.5,'成'),COLORMAGENTA;
DRAWTEXT(FILTER(底背离消失,10),(DIFF+MACD),'失'),COLORGREEN;
STICKLINE(BG,0,DIFF+DEA,5,0),COLORRED,LINETHICK3;
金叉:=CROSS(DIFF,DEA);
DRAWICON(金叉,DIFF*0.95,'1');
M1:=BARSLAST(金叉),NODRAW;
M2:=REF(BARSLAST(金叉),M1+1);
M3:=REF(BARSLAST(金叉),M2+M1+2);
CH1:=HHV(C,M1+1),NODRAW;
DIFH1:=HHV(DIFF,M1+1),NODRAW;
CH2:=REF(CH1,M1+1),NODRAW;
DIFH2:=REF(DIFH1,M1+1),NODRAW;
CH3:=REF(CH2,M1+1),NODRAW;
DIFH3:=REF(DIFH2,M1+1),NODRAW;
PDIFH2:=IF(DIFH2>0,INTPART(LOG(DIFH2))-1,INTPART(LOG(-DIFH2))-1);
MDIFH2:=INTPART(DIFH2/POW(10,PDIFH2));
PDIFH3:=IF(DIFH3>0,INTPART(LOG(DIFH3))-1,INTPART(LOG(-DIFH3))-1);
MDIFH3:=INTPART(DIFH3/POW(10,PDIFH3));
MDIFT2:=INTPART(DIFF/POW(10,PDIFH2));
MDIFT3:=INTPART(DIFF/POW(10,PDIFH3));
直接顶背离:=(CH1>CH2 ) AND (MDIFT2
隔峰顶背离:=(CH1>CH3 AND CH3>CH2 ) AND (MDIFT3
T:=直接顶背离 OR 隔峰顶背离,NODRAW;
TG:=((MDIFT2
顶背离消失:=(REF(直接顶背离,1) AND DIFH1>=DIFH2 ) OR (REF(隔峰顶背离,1) AND DIFH1>=DIFH3);
STICKLINE(TG,0,DIFF+DEA,5,0), COLORGREEN,LINETHICK4;
STICKLINE(T OR TG,DIFF,DEA,8,0),COLORGREEN,LINETHICK2;
DRAWTEXT(FILTER(TG,20),DIFF*1.4,'成'),COLORMAGENTA;
DRAWTEXT(FILTER(顶背离消失,20),(DIFF+MACD),'失'),COLORGREEN;