廷引1:=EMA(EMA(EMA(CLOSE,5),5),5);
廷引2:=EMA(EMA(EMA(CLOSE,7),7),7);
廷引3:=EMA(EMA(EMA(CLOSE,12),12),12);
DIF:(廷引1-REF(廷引1,1))/REF(廷引1,1)*200,COLORFF00FF,LINETHICK2;
DEA:(廷引2-REF(廷引2,1))/REF(廷引2,1)*250,COLORGREEN,LINETHICK2;
多線:(廷引3-REF(廷引3,1))/REF(廷引3,1)*300,COLOR99EEEE,LINETHICK1;
空線:MA(多線,9),COLORRED,LINETHICK1;
DRAWBAND(多線,RGB(255,0,0),空線,RGB(0,100,50));
紅藍帶:(廷引1-廷引2)*5,COLORSTICK;
零軸線:0.00,COLOR0099FF,DOTLINE;
DRAWTEXT_FIX(1,0.23,0.05,0,'不出高紅柱不出手,見了高紅柱及時買進,一輩子也只做MACD出了紅柱子的股票、均線多頭的股票')COLORYELLOW;
{底部結構預警}
死叉:=CROSS(DEA,DIF);
N1:=BARSLAST(死叉),NODRAW;{最近一次死叉的位置}
N2:=REF(BARSLAST(死叉),N1 1),NODRAW;{倒數(shù)第二次死叉與倒數(shù)第一次死叉的區(qū)間}
N3:=REF(BARSLAST(死叉),N2 N1 2),NODRAW;{倒數(shù)第三次死叉與倒數(shù)第二次死叉的區(qū)間}
CL1:=LLV(C,N1 1),NODRAW;{最近一次死叉后,最低收盤價}
DIFL1:=LLV(DIF,N1 1),NODRAW;
CL2:=REF(CL1,N1 1),NODRAW;{倒數(shù)第二次死叉與倒數(shù)第一次死叉之間的最低收盤價}
DIFL2:=REF(DIFL1,N1 1),NODRAW;
CL3:=REF(CL2,N1 1),NODRAW;{倒數(shù)第三次死叉與倒數(shù)第二次死叉之間的最低收盤價}
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(DIF/POW(10,PDIFL2));
MDIFB3:=INTPART(DIF/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;
{DRAWTEXT(TFILTER(B,(REF(DIF,1)>REF(DIF,2) AND DIF
STICKLINE(B,DIF,DEA,1,0),COLORRED;
DRAWTEXT(TFILTER(BG,C
{頂部結構預警}
金叉:=CROSS(DIF,DEA);
M1:=BARSLAST(金叉),NODRAW;{最近一次金叉的位置}
M2:=REF(BARSLAST(金叉),M1 1),NODRAW;{倒數(shù)第二次金叉與倒數(shù)第一次金叉的區(qū)間}
M3:=REF(BARSLAST(金叉),M2 M1 2),NODRAW;{倒數(shù)第三次金叉與倒數(shù)第二次金叉的區(qū)間}
CH1:=HHV(C,M1 1),NODRAW;{最近一次金叉后,最高收盤價}
DIFH1:=HHV(DIF,M1 1),NODRAW;
CH2:=REF(CH1,M1 1),NODRAW;{倒數(shù)第二次金叉與倒數(shù)第一次金叉之間的最高收盤價}
DIFH2:=REF(DIFH1,M1 1),NODRAW;
CH3:=REF(CH2,M1 1),NODRAW;{倒數(shù)第三次金叉與倒數(shù)第二次金叉之間的最高收盤價}
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(DIF/POW(10,PDIFH2));
MDIFT3:=INTPART(DIF/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
{DRAWTEXT(TFILTER(T,(REF(DIF,1)REF(DIF,1)),1),DIFH2,'鈍化開始'),COLORYELLOW;}
STICKLINE(T,DIF,DEA,1,0),COLORGREEN;
DRAWTEXT(TFILTER(TG,C>REF(CH1,1),1),DIF*1.001,'頂結構形成')COLORWHITE;
X:=MA(AMOUNT,5)/MA(V,5)/100;
VAR3:=(X-MA(AMOUNT,125)/MA(V,125)/100)/X;
VAR4:=MA((LLV(L,45)-C)/(HHV(H,45)-LLV(L,45))*100,3);
VAR5:=C/MA(C,60)-1;
大底:IF(CROSS(-5,VAR4) AND VAR3<-0.4,-0.01,-2);
中底:IF(CROSS(-5,VAR4) AND VAR3<-0.25 AND VAR3>-0.4,-0.3,-1);
短底:IF(CROSS(-5,VAR4) AND VAR3<-0.15 AND VAR3>-0.25,-0.6,-1);
減倉:IF(CROSS(VAR4,-95) AND VAR5<0.2 AND VAR5>=0.1,0.6,1);
中頂:IF(CROSS(VAR4,-95) AND VAR5<0.35 AND VAR5>=0.2,0.3,1);
大頂:IF(CROSS(VAR4,-95) AND VAR5>=0.35,0,2);
DRAWTEXT(CROSS(-5,VAR4) AND VAR3<-0.4,0.01,'大底'),COLORYELLOW;
DRAWTEXT(CROSS(-5,VAR4) AND VAR3<-0.4,-2.01,'大底'),COLORYELLOW;
DRAWTEXT(CROSS(-5,VAR4) AND VAR3<-0.4,-5.01,'大底'),COLORYELLOW;
DRAWTEXT(CROSS(-5,VAR4) AND VAR3<-0.4,2.01,'大底'),COLORYELLOW;
DRAWTEXT(CROSS(-5,VAR4) AND VAR3<-0.4,3.01,'大底'),COLORYELLOW;
DRAWTEXT(CROSS(-5,VAR4) AND VAR3<-0.25 AND VAR3>-0.4,0.01,'中底'),COLORYELLOW;
DRAWTEXT(CROSS(-5,VAR4) AND VAR3<-0.15 AND VAR3>-0.25,0.01,'短底'),COLORGREEN;
DRAWTEXT(CROSS(VAR4,-95) AND VAR5<0.2 AND VAR5>=0.1,0.08,'減倉'),COLORGREEN;
DRAWTEXT(CROSS(VAR4,-95) AND VAR5<0.35 AND VAR5>=0.2,0.08,'中期頂'),COLORGREEN;
DRAWTEXT(CROSS(VAR4,-95) AND VAR5<0.35 AND VAR5>=0.2,1.08,'中期頂'),COLORGREEN;
DRAWTEXT(CROSS(VAR4,-95) AND VAR5>=0.35,0.02,'大頂清倉')COLORGREEN;
DRAWTEXT(CROSS(VAR4,-95) AND VAR5>=0.35,0.6,'大頂清倉')COLORGREEN;
DRAWTEXT(CROSS(VAR4,-95) AND VAR5>=0.35,10.02,'大頂清倉')COLORGREEN;
DRAWTEXT(CROSS(VAR4,-95) AND VAR5>=0.35,8,'大頂清倉')COLORGREEN;
DRAWTEXT(CROSS(VAR4,-95) AND VAR5>=0.35,6.02,'大頂清倉')COLORGREEN;
DRAWTEXT(CROSS(VAR4,-95) AND VAR5>=0.35,3,'大頂清倉')COLORGREEN;