参数设置 SHORE 12 LONG 26 MID 9
DIF:EMA(CLOSE,SHORT)-EMA(CLOSE,LONG); DEA:EMA(DIF,MID),COLOR888888; {NOTEXT1:IF(DIF>-0.4, DIF,DRAWNULL),COLORRED; NOTEXT2:IF(DIF> AND DIF<REF(DIF,), DIF,DRAWNULL),COLORGREEN; NOTEXT3:IF(DIF< AND DIF>REF(DIF,), DIF,DRAWNULL),COLORFF00FF; NOTEXT4:IF(DIF< AND DIF<REF(DIF,), DIF,DRAWNULL),COLORWHITE;} NOTEXT5:IF(DIF>=DEA, DIF,DRAWNULL),COLORRED; NOTEXT6:IF(DIF<DEA, DIF,DRAWNULL),COLORWHITE; AT1:=BARSLAST(REF(CROSS(DIF,DEA),)); BT1:=REF(C,AT1+)>C AND REF(DIF,AT1+)<DIF AND CROSS(DIF,DEA); AT2:=BARSLAST(REF(CROSS(,,),,,)),)); CT1:=BARSLAST(REF(CROSS(DEA,DIF),)); DT1:=REF(C,CT1+)<C AND REF(DIF,CT1+)>DIF AND CROSS(DEA,DIF); MACD底背:IF(BT1>,-),COLORRED; MACD顶背:IF(DT1>,),COLOR00FF00; STICKLINE(BT1>,,,),COLORRED; STICKLINE(DT1>,,,),COLOR00FF00; MACD:(DIF-DEA)*,COLORSTICK; STICKLINE(MACD<REF(MACD,) AND MACD>, ,MACD,,),COLOR44FF00; STICKLINE(MACD>REF(MACD,) AND MACD<, ,MACD,,),COLOR0066FF; M1:=; M2:=; A1:=REF(DIF,M1)=HHV(DIF,*M1+); B1:=FILTER(A1,M1); C1:=BACKSET(B1,M1+); D1:=FILTER(C1,M1); E1:=BACKSET(ISLASTBAR,BARSLAST(D1)+); F1:=E1>REF(E1,); A2:=REF(DIF,M2)=LLV(DIF,*M2+); B2:=FILTER(A2,M2); C2:=BACKSET(B2,M2+); D2:=FILTER(C2,M2); E2:=BACKSET(ISLASTBAR,BARSLAST(D2)+); F2:=E2>REF(E2,); 压力线:DRAWLINE(D1,DIF,F1,DIF,),COLORFFFF00,DOTLINE; 支撑线:DRAWLINE(D2,DIF,F2,DIF,),COLOR00AAFF,DOTLINE; G3:=FILTERX(支撑线>REF(支撑线,) && DIF>支撑线 && REF(支撑线,)=REF(DIF,),); 底抬高:DRAWLINE(D2,DIF,G3,支撑线,),COLORYELLOW,DOTLINE; {画趋势线} M:=INTPART(*/); A12:=REF(DIF,M)=HHV(DIF,*M+); B12:=FILTER(A12,M); C12:=BACKSET(B12,M+); D12:=FILTER(C12,M); R112:=BACKSET(ISLASTBAR,BARSLAST(D12)+); S112:=R112>REF(R112,); AL12:=REF(DIF,M)=LLV(DIF,*M+); BL12:=FILTER(AL12,M); CL12:=BACKSET(BL12,M+); DL12:=FILTER(CL12,M); RL112:=BACKSET(ISLASTBAR,BARSLAST(DL12)+); SL112:=RL112>REF(RL112,); 短压线:DRAWLINE(D12,DIF,S112,DIF,),COLOR99FF00,DOTLINE; 短撑线:DRAWLINE(DL12,DIF,SL112,DIF,),COLOR0055FF,DOTLINE; VARX2:=LLV(DEA,); VARX3:=DEA-(DIF-DEA); 低点线:=IF(DIF<VARX2 AND DEA=VARX2,MIN(HHV(VARX2,),VARX3),VARX2); VL:=REF(LOW,); VAR12:=(SMA(ABS(LOW-VL),,))/(SMA(MAX(LOW-VL,),,))*; VAR14:=MA(VAR12,); VAR15:=LLV(LOW,); VAR18:=EMA(IF(LOW<=VAR15,VAR14,),); VAR110:=SMA(SMA((CLOSE-LLV(LOW,))/(HHV(HIGH,)-LLV(LOW,))*,,),,); VAR111:=SMA((CLOSE-LLV(LOW,))/(HHV(HIGH,)-LLV(LOW,))*,,)*-VAR110*10.38; T:=FILTER(IF(VAR111<=VAR110 AND VAR18>,VAR18*,),); 止跌:DRAWTEXT(T AND DIF<低点线,DIF*1.01,'止跌'),COLORYELLOW; {形态} A:=IF(CROSS(,DEA),,); A11:=IF(DIF< AND CROSS(DIF,DEA),,); SS:=IF(A,SUM(A11,),); SSB:=HHV(SS,); SSS:=SUM(A11,); W底:=SSS-SSB= AND SSS>REF(SSS,); DRAWTEXT(W底,DIF,'↖W底'),COLOR0080FF; MACD金叉:=CROSS(MACD,DIF) AND MACD>=(-0.05) AND MACD<=0.02; DRAWTEXT(MACD金叉,MACD,'-MACD金叉'),COLOR00FFFF; 低位金叉:=CROSS(DIF,DEA) AND DIF<-0.1; JCCOUNT:=COUNT(CROSS(DIF,DEA),BARSLAST(DEA>=)); 二次金叉:=CROSS(DIF,DEA) AND DEA< AND COUNT(JCCOUNT=,)=; DRAWTEXT(二次金叉,0.01,'二次金叉'),COLOR5500FF; AA11:=BARSLAST(REF(CROSS(DIF,DEA),)); 底背离:=REF(CLOSE,AA11+)>CLOSE AND DIF>REF(DIF,AA11+) AND CROSS(DIF,DEA); 底背:DRAWLINE(AA11=,DIF,底背离,DIF,),COLORYELLOW,LINETHICK2; AA22:=BARSLAST(REF(CROSS(DEA,DIF),)); 顶背离:=REF(CLOSE,AA22+)<CLOSE AND REF(DIF,AA22+)>DIF AND CROSS(DEA,DIF); 顶背:DRAWLINE(AA22=,DIF,顶背离,DIF,),COLORGREEN,LINETHICK2; DRAWTEXT(底背离,DIF*0.5,'-DIF底背'),COLOR0055FF; DRAWTEXT(顶背离,DIF*0.5,'-DIF顶背'),COLOR99FF00; {小周期} N:=; DIF3_6.5F:=(EMA(CLOSE,)-(EMA(CLOSE,)+EMA(CLOSE,))/); DEA3_6.5F:=(EMA(DIF3_6.5F,)+EMA(DIF3_6.,)); AA:=REF(DIF3_6.5F,N)=HHV(DIF3_6.5F,*N+); CC:=FILTER(BB,N) AND DIF3_6.5F=HHV(DIF3_6.5F,N+); AX1:=BARSLAST(REF(CC,)); 小顶背离:=REF(CLOSE,AX1+)<CLOSE AND REF(DIF3_6.5F,AX1+)>DIF3_6.5F AND CC; DRAWTEXT(小顶背离,DIF3_6.5F*1.2,'-小顶背离'),COLORGREEN; DRAWICON(小顶背离>,DIF3_6.5F*); AAA2:=REF(DIF3_6.5F,N)=LLV(DIF3_6.5F,*N+); BBB2:=BACKSET(AAA2,N+); CCC2:=FILTER(BBB2,N) AND DIF3_6.5F=LLV(DIF3_6.5F,N+); AX2:=BARSLAST(REF(CCC2,)); 小底背离:=REF(CLOSE,AX2+)>CLOSE AND REF(DIF3_6.5F,AX2+)<DIF3_6.5F; {画白柱线} VA1:=HHVBARS(MACD,BARSLAST(MACD<)+); VA2:=CROSS(BACKSET(CROSS(,MACD),REF(VA1,)+),0.5); QG:=CROSS(BACKSET(CROSS(,MACD) OR (ISLASTBAR AND MACD>),REF(VA1,)+),0.5); 前高:=DRAWLINE(VA2,MACD,REF(VA2,),REF(MACD,),),COLORMAGENTA; VA3:=LLVBARS(MACD,BARSLAST(MACD>)+); VA4:=CROSS(BACKSET(CROSS(MACD,),REF(VA3,)+),0.5); 前低:=DRAWLINE(VA4,MACD,REF(VA4,),REF(MACD,),); BD:=BARSLAST(FILTERX(CROSS(,MACD),BARSCOUNT(C))); BDTJ:=IF(MACD<,FILTERX(MACD=LLV(MACD,BARSLAST(MACD>)), BARSCOUNT(C)),DRAWNULL); TSBDTJ:=BARSLAST(BDTJ); BDZH:=FILTERX(MACD<CONST(LLV(MACD,BD+)),BARSCOUNT(C)); BDTS:=BARSLAST(BDZH); 本低:=IF(BD+>=,CONST(LLV(MACD,BD+)),DRAWNULL); BDCL:=CROSS(COUNT(CROSS(MACD>本低/ AND MACD<,,; 终点:=IF(ISLASTBAR AND MACD> AND MACD=HHV(MACD,BARSLAST(MACD<)),, IF(FILTERX(QG,BARSCOUNT(C)),,DRAWNULL)); UU:=(终点= OR 终点=) AND MACD>; ZZ:=FILTERX(UU,BARSCOUNT(C)); 本高:=DRAWLINE(ZZ,MACD,REF(ZZ,),REF(MACD,),),COLORWHITE; WQG:=CROSS(COUNT(CROSS(MACD<本高/ AND MACD>,,; STICKLINE(MACD>前高,MACD,前高,,),COLORFFFFFF; STICKLINE(MACD< AND MACD<前低 AND 前低<,MACD,前低,,),COLORFFFFFF; DRAWICON(CROSS(DIF,DEA),DEA,); DRAWICON(CROSS(DEA,DIF),DEA,); 底:ABS((CROSS("MACD.DIF","MACD.DEA")&&"MACD.DEA"<=-0.07)*"MACD.DIF")*1.50,COLORLIMAGENTA; DRAWTEXT(ABS(底)>,底*1.20,'底'),COLORYELLOW;