M1:=5; M2:=10; M3:=20; M4:=60; P1:=5; JJJ:=IF(DYNAINFO(8)>0.01,0.01*DYNAINFO(10)/DYNAINFO(8),DYNAINFO(3)); DDD:=(DYNAINFO(5)<0.01 || DYNAINFO(6)<0.01); JJJT:=IF(DDD,1,(JJJ<(DYNAINFO(5)+0.01) && JJJ>(DYNAINFO(6)-0.01))); A1:=C>=REF(C,4); A2:=C<REF(C,4); A3:=C<REF(C,4) AND REF(A1,1); T:=BARSLAST(A3),NODRAW; M0:=(T=0 AND REFX(T=1 AND NOT(A2),1)) OR (REFX(T=2 AND NOT(A2),2)) OR (REFX(T=3 AND NOT(A2),3)) OR (REFX(T=4 AND NOT(A2),4)) OR (REFX(T=5 AND NOT(A2),5)) OR (REFX(T=6 AND NOT(A2),6)) OR (REFX(T=7 AND NOT(A2),7)) OR (REFX(T=8 AND NOT(A2),8)); M1:=T=1 AND REFX(T=2 AND NOT(A2),1) OR (REFX(T=3 AND NOT(A2),2)) OR (REFX(T=4 AND NOT(A2),3)) OR (REFX(T=5 AND NOT(A2),4)) OR (REFX(T=6 AND NOT(A2),5)) OR (REFX(T=7 AND NOT(A2),6)) OR (REFX(T=8 AND NOT(A2),7)); M2:=T=2 AND REFX(T=3 AND NOT(A2),1) OR (REFX(T=4 AND NOT(A2),2)) OR (REFX(T=5 AND NOT(A2),3)) OR (REFX(T=6 AND NOT(A2),4)) OR (REFX(T=7 AND NOT(A2),5)) OR (REFX(T=8 AND NOT(A2),6)); M3:=T=3 AND REFX(T=4 AND NOT(A2),1)OR (REFX(T=5 AND NOT(A2),2)) OR (REFX(T=6 AND NOT(A2),3)) OR (REFX(T=7 AND NOT(A2),4)) OR (REFX(T=8 AND NOT(A2),5)); M4:=T=4 AND REFX(T=5 AND NOT(A2),1) OR (REFX(T=6 AND NOT(A2),2)) OR (REFX(T=7 AND NOT(A2),3)) OR (REFX(T=8 AND NOT(A2),4)); M5:=T=5 AND REFX(T=6 AND NOT(A2),1) OR (REFX(T=7 AND NOT(A2),2)) OR (REFX(T=8 AND NOT(A2),3)); M6:=T=6 AND REFX(T=7 AND NOT(A2),1) OR (REFX(T=8 AND NOT(A2),2)); M7:=T=7 AND REFX(T=8 AND NOT(A2),1); N0:=T=1 AND REF(T=0 AND A3,1) AND A2; N1:=T=2 AND REF(N0,1) AND A2; N2:=T=3 AND REF(N1,1) AND A2; N3:=T=4 AND REF(N2,1) AND A2; N4:=T=5 AND REF(N3,1) AND A2; N5:=T=6 AND REF(N4,1) AND A2; N6:=T=7 AND REF(N5,1) AND A2; N7:=T=8 AND REF(N6,1) AND A2; WZD:=L*0.985; WZG:=H*1.011; DRAWTEXT(T=0 AND NOT(M0),WZD,''1''),COLORGREEN; DRAWTEXT(N0 AND NOT(M1),WZD,''2''),COLORGREEN; DRAWTEXT(N1 AND NOT(M2),WZD,''3''),COLORGREEN; DRAWTEXT(N2 AND NOT(M3),WZD,''4''),COLORGREEN; DRAWTEXT(N3 AND NOT(M4),WZD,''5''),COLORGREEN; DRAWTEXT(N4 AND NOT(M5),WZD,''6''),COLORGREEN; DRAWTEXT(N5 AND NOT(M6),WZD,''7''),COLORGREEN; DRAWTEXT(N6 AND NOT(M7),WZD,''8''),COLORGREEN; DRAWTEXT(N7,WZG,''9''),LINETHICK9,COLORMAGENTA,; B1:=C<=REF(C,4); B2:=C>REF(C,4); B3:=C>REF(C,4) AND REF(B1,1); T1:=BARSLAST(B3),NODRAW; M8:=(T1=0 AND REFX(T1=1 AND NOT(B2),1)) OR (REFX(T1=2 AND NOT(B2),2)) OR (REFX(T1=3 AND NOT(B2),3)) OR (REFX(T1=4 AND NOT(B2),4)) OR (REFX(T1=5 AND NOT(B2),5)) OR (REFX(T1=6 AND NOT(B2),6)) OR (REFX(T1=7 AND NOT(B2),7)) OR (REFX(T1=8 AND NOT(B2),8)); M9:=T1=1 AND REFX(T1=2 AND NOT(B2),1) OR (REFX(T1=3 AND NOT(B2),2)) OR (REFX(T1=4 AND NOT(B2),3)) OR (REFX(T1=5 AND NOT(B2),4)) OR (REFX(T1=6 AND NOT(B2),5)) OR (REFX(T1=7 AND NOT(B2),6)) OR (REFX(T1=8 AND NOT(B2),7)); M10:=T1=2 AND REFX(T1=3 AND NOT(B2),1) OR (REFX(T1=4 AND NOT(B2),2)) OR (REFX(T1=5 AND NOT(B2),3)) OR (REFX(T1=6 AND NOT(B2),4)) OR (REFX(T1=7 AND NOT(B2),5)) OR (REFX(T1=8 AND NOT(B2),6)); M11:=T1=3 AND REFX(T1=4 AND NOT(B2),1)OR (REFX(T1=5 AND NOT(B2),2)) OR (REFX(T1=6 AND NOT(B2),3)) OR (REFX(T1=7 AND NOT(B2),4)) OR (REFX(T1=8 AND NOT(B2),5)); M12:=T1=4 AND REFX(T1=5 AND NOT(B2),1) OR (REFX(T1=6 AND NOT(B2),2)) OR (REFX(T1=7 AND NOT(B2),7)) OR (REFX(T1=8 AND NOT(B2),4)); M13:=T1=5 AND REFX(T1=6 AND NOT(B2),1) OR (REFX(T1=7 AND NOT(B2),2)) OR (REFX(T1=8 AND NOT(B2),3)); M14:=T1=6 AND REFX(T1=7 AND NOT(B2),1) OR (REFX(T1=8 AND NOT(B2),2)); M15:=T1=7 AND REFX(T1=8 AND NOT(B2),1); N8:=T1=1 AND REF(T1=0 AND B3,1) AND B2; N9:=T1=2 AND REF(N8,1) AND B2; N10:=T1=3 AND REF(N9,1) AND B2; N11:=T1=4 AND REF(N10,1) AND B2; N12:=T1=5 AND REF(N11,1) AND B2; N13:=T1=6 AND REF(N12,1) AND B2; N14:=T1=7 AND REF(N13,1) AND B2; N15:=T1=8 AND REF(N14,1) AND B2; DRAWTEXT(T1=0 AND NOT(M8),WZG,''1''),COLOR9900CC; DRAWTEXT(N8 AND NOT(M9),WZG,''2''),COLOR9900CC; DRAWTEXT(N9 AND NOT(M10),WZG,''3''),COLOR9900CC; DRAWTEXT(N10 AND NOT(M11),WZG,''4''),COLOR9900CC; DRAWTEXT(N11 AND NOT(M12),WZG,''5''),COLOR9900CC; DRAWTEXT(N12 AND NOT(M13),WZG,''6''),COLOR9900CC; DRAWTEXT(N13 AND NOT(M14),WZG,''7''),COLOR9900CC; DRAWTEXT(N14 AND NOT(M15),WZG,''8''),COLOR9900CC; DRAWTEXT(N15 ,WZD,''9''),LINETHICK3,COLORGREEN; {背離}; AN1:=BARSLAST(REF(CROSS("MACD.DIF","MACD.DEA"),1)); BN1:=REF(C,AN1+1)>C AND REF("MACD.DIF",AN1+1)<"MACD.DIF" AND CROSS("MACD.DIF","MACD.DEA"); DRAWTEXT(BN1>0,WZD,''MACD底背''),COLORYELLOW; CN1:=BARSLAST(REF(CROSS("MACD.DEA","MACD.DIF"),1)); DN1:=REF(C,CN1+1)<C AND REF("MACD.DIF",CN1+1)>"MACD.DIF" AND CROSS("MACD.DEA","MACD.DIF"); DRAWTEXT(DN1>0,WZG,''MACD頂離''),COLORGREEN;{MACD頂背離}; {N1111:1,100,10;N22:1,100,10;DISP:=1,3,2}; N1111:=10;N22:=10;DISP:=2; K:=IF(PERIOD=5,1,{日} IF(PERIOD=6,1,{周} IF(PERIOD=7,1,{月} IF(PERIOD=8,1,{多分鐘} IF(PERIOD=9,1,{多日} IF(PERIOD=10,1,{季} IF(PERIOD=11,2,{年} IF(PERIOD=4,1,{60F} IF(PERIOD=3,1,{30F} IF(PERIOD=2,1,{15F} IF(PERIOD=1,1{5F},1{1F})))))))))))/10; P1:=PEAK(1,K*N1111,1); P2:=PEAK(1,K*N1111,2); WP1:=PEAKBARS(1,K*N1111,1); WP2:=PEAKBARS(1,K*N1111,2); T111:=TROUGH(2,K*N22,1); T2:=TROUGH(2,K*N22,2); WT111:=TROUGHBARS(2,K*N22,1); WT2:=TROUGHBARS(2,K*N22,2); TJ1:=P1>T111 AND P2>T2 ; ZD:=MAX(T111,T2); ZG:=MIN(P1,P2); LL:=MIN(T111,T2); HH:=MAX(P1,P2); TJ2:=FILTER(ZG>ZD,2); TJ3:=ZG=REF(ZG,BARSLAST(TJ2)) OR ZD=REF(ZD,BARSLAST(TJ2)); TJ4:=TJ1&&TJ2&&NOT(TJ3); TJ5:=BETWEEN(ZD,REF(ZD,REF(BARSLAST(TJ4),1)),REF(ZG,REF(BARSLAST(TJ4),1))); TJ6:=BETWEEN(ZG,REF(ZD,REF(BARSLAST(TJ4),1)),REF(ZG,REF(BARSLAST(TJ4),1))); TJ7:=ZG>REF(ZG,REF(BARSLAST(TJ4),1))&&ZD<REF(ZD,REF(BARSLAST(TJ4),1)); TJ8:=TJ4&&NOT(TJ5 OR TJ6 OR TJ7); ZSD:=IF(TJ8,ZD,DRAWNULL); ZSG:=IF(TJ8,ZG,DRAWNULL); ZSH:=IF(TJ8,HH,DRAWNULL); ZSL:=IF(TJ8,LL,DRAWNULL); STICKLINE(TJ8,ZSH,ZSL,0,-1),COLORMAGENTA; STICKLINE(TJ8,ZSD,ZSG,IF(DISP=1,3,0),1),COLORMAGENTA; DRAWTEXT(DISP=2,ZSH,''中樞''),COLORRED; 中樞高:PLOYLINE(DISP=2,REF(ZSD,BARSLAST(TJ8))),CROSSDOT,COLORLIRED; 中樞低:PLOYLINE(DISP=2,REF(ZSG,BARSLAST(TJ8))),CROSSDOT,COLORLIGREEN; 中樞最高:PLOYLINE(DISP=2,REF(ZSH,BARSLAST(TJ8))),POINTDOT,COLORRED; 中樞最低:PLOYLINE(DISP=2,REF(ZSL,BARSLAST(TJ8))),POINTDOT,COLORGREEN; 趨勢(shì)高:PLOYLINE(DISP=3,ZIG(1,K*N1111)),COLORLIBLUE; 趨勢(shì)低:PLOYLINE(DISP=3,ZIG(2,K*N22)),COLORLIBLUE; 局部低點(diǎn)預(yù)選A:=BACKSET(LLV(L,5)<REF(LLV(L,4),1),4); 局部低點(diǎn)預(yù)選B:=BACKSET(局部低點(diǎn)預(yù)選A=0 AND REF(局部低點(diǎn)預(yù)選A,1)=1,2); 局部低點(diǎn)預(yù)選C:=IF(局部低點(diǎn)預(yù)選B=1 AND REF(局部低點(diǎn)預(yù)選B,1)=0,-1,0); 局部高點(diǎn)預(yù)選A:=BACKSET(HHV(H,5)>REF(HHV(H,4),1),4); 局部高點(diǎn)預(yù)選B:=BACKSET(局部高點(diǎn)預(yù)選A=0 AND REF(局部高點(diǎn)預(yù)選A,1)=1,2); 局部高點(diǎn)預(yù)選C:=IF(局部高點(diǎn)預(yù)選B=1 AND REF(局部高點(diǎn)預(yù)選B,1)=0,1,0); 缺口判斷:=IF(L>REF(H,1),1,IF(H<REF(L,1),-1,0)); 距前高天:=BARSLAST(局部高點(diǎn)預(yù)選C=1); 距前低天:=BARSLAST(局部低點(diǎn)預(yù)選C=-1); 小值周期:=LOWRANGE(L); 大值周期:=TOPRANGE(H); 低保留AA:=IF(局部低點(diǎn)預(yù)選C=-1 AND REF(距前高天,1)>REF(距前低天,1) AND LLV(L,距前高天+1)<REF(LLV(L,距前高天+1),1),-1,0); 低保留AB:=IF(局部低點(diǎn)預(yù)選C=-1 AND REF(距前高天,1)<=REF(距前低天,1) AND (距前高天>=4 OR LLV(缺口判斷,距前高天)=-1 OR LLV(L,距前低天+2)<REF(LLV(L,距前低天+1),1)),-1,0); 低保留S:=IF((低保留AA=-1 OR 低保留AB=-1) AND L<REF(H,距前高天+1),-1,0); 預(yù)判:=IF((距前低天<4 AND HHV(缺口判斷,距前低天)!=1) OR REF(低保留S,距前低天)=0,1,0); 判斷:=IF(局部高點(diǎn)預(yù)選C=1 AND REF(距前低天,1)<=REF(距前高天,1) AND 預(yù)判=1 AND 大值周期>REF(小值周期,距前低天+1) AND 大值周期>REF(小值周期,距前低天) AND 大值周期>REF(大值周期,距前高天),1,0); 高保留A:=IF(局部高點(diǎn)預(yù)選C=1 AND REF(距前低天,1)>REF(距前高天,1) AND HHV(H,距前低天+1)>REF(HHV(H,距前低天+1),1),1,0); 高保留B:=IF(局部高點(diǎn)預(yù)選C=1 AND REF(距前低天,1)<=REF(距前高天,1) AND REF(低保留S,距前低天)=-1 AND (距前低天>=4 OR HHV(缺口判斷,距前低天)=1),1,0); 高保留:=IF((高保留A=1 OR 高保留B=1 OR 判斷=1) AND H>REF(L,距前低天+1),1,0); 預(yù)判A:=IF((距前高天<4 AND HHV(缺口判斷,距前高天)!=1) OR REF(高保留,距前高天)=0,1,0); 判斷A:=IF(局部低點(diǎn)預(yù)選C=-1 AND REF(距前高天,1)<=REF(距前低天,1) AND 預(yù)判A=1 AND 小值周期>REF(大值周期,距前高天+1) AND 小值周期>REF(大值周期,距前高天) AND 小值周期>REF(小值周期,距前低天),-1,0); 低保留A:=IF(局部低點(diǎn)預(yù)選C=-1 AND REF(距前高天,1)>REF(距前低天,1) AND LLV(L,距前高天+1)<REF(LLV(L,距前高天+1),1),-1,0); 低保留B:=IF(局部低點(diǎn)預(yù)選C=-1 AND REF(距前高天,1)<=REF(距前低天,1) AND (距前高天>=4 OR LLV(缺口判斷,距前高天)=-1 OR 判斷A=-1),-1,0); 低保留:=IF((低保留A=-1 OR 低保留B=-1) AND L<REF(H,距前高天+1),-1,0); 距前高天A:=BARSLAST(高保留=1); 距前低天A:=BARSLAST(低保留=-1); 預(yù)判X:=IF((距前低天A<4 AND HHV(缺口判斷,距前低天A)!=1) OR REF(低保留,距前低天A)=0,1,0); 判斷X:=IF(局部高點(diǎn)預(yù)選C=1 AND REF(距前低天A,1)<=REF(距前高天A,1) AND 預(yù)判X=1 AND 大值周期>REF(小值周期,距前低天A+1) AND 大值周期>REF(小值周期,距前低天A) AND 大值周期>REF(大值周期,距前高天A),1,0); 高保留XA:=IF(局部高點(diǎn)預(yù)選C=1 AND REF(距前低天A,1)>REF(距前高天A,1) AND HHV(H,距前低天A+1)>REF(HHV(H,距前低天A+1),1),1,0); 高保留XB:=IF(局部高點(diǎn)預(yù)選C=1 AND REF(距前低天A,1)<=REF(距前高天A,1) AND REF(低保留,距前低天A)=-1 AND (距前低天A>=4 OR HHV(缺口判斷,距前低天A)=1),1,0); 高保留X:=IF((高保留XA=1 OR 高保留XB=1 OR 判斷X=1) AND H>REF(L,距前低天A+1),1,0); 預(yù)判XA:=IF((距前高天A<4 AND HHV(缺口判斷,距前高天A)!=1) OR REF(高保留XA,距前高天A)=0,1,0); 判斷XA:=IF(局部低點(diǎn)預(yù)選C=-1 AND REF(距前高天A,1)<=REF(距前低天A,1) AND 預(yù)判XA=1 AND 小值周期>REF(大值周期,距前高天A+1) AND 小值周期>REF(大值周期,距前高天A) AND 小值周期>REF(小值周期,距前低天A),-1,0); 低保留XA:=IF(局部低點(diǎn)預(yù)選C=-1 AND REF(距前高天A,1)>REF(距前低天A,1) AND LLV(L,距前高天A+1)<REF(LLV(L,距前高天A+1),1),-1,0); 低保留XB:=IF(局部低點(diǎn)預(yù)選C=-1 AND REF(距前高天A,1)<=REF(距前低天A,1) AND (距前高天A>=4 OR LLV(缺口判斷,距前高天A)=-1 OR 判斷XA=-1),-1,0); 低保留X:=IF((低保留XA=-1 OR 低保留XB=-1) AND L<REF(H,距前高天A+1),-1,0); 距前高天YA:=BARSLAST(高保留X=1); 距前低天YA:=BARSLAST(低保留X=-1); 預(yù)判YX:=IF((距前低天YA<4 AND HHV(缺口判斷,距前低天YA)!=1) OR REF(低保留X,距前低天YA)=0,1,0); 判斷YX:=IF(局部高點(diǎn)預(yù)選C=1 AND REF(距前低天YA,1)<=REF(距前高天YA,1) AND 預(yù)判YX=1 AND 大值周期>REF(小值周期,距前低天YA+1) AND 大值周期>REF(小值周期,距前低天YA) AND 大值周期>REF(大值周期,距前高天YA),1,0); 高保留YXA:=IF(局部高點(diǎn)預(yù)選C=1 AND REF(距前低天YA,1)>REF(距前高天YA,1) AND HHV(H,距前低天YA+1)>REF(HHV(H,距前低天YA+1),1),1,0); 高保留YXB:=IF(局部高點(diǎn)預(yù)選C=1 AND REF(距前低天YA,1)<=REF(距前高天YA,1) AND REF(低保留X,距前低天YA)=-1 AND (距前低天YA>=4 OR HHV(缺口判斷,距前低天YA)=1),1,0); 高保留YX:=IF((高保留YXA=1 OR 高保留YXB=1 OR 判斷YX=1) AND H>REF(L,距前低天YA+1),1,0); 預(yù)判YXA:=IF((距前高天YA<4 AND HHV(缺口判斷,距前高天YA)!=1) OR REF(高保留YXA,距前高天YA)=0,1,0); 判斷YXA:=IF(局部低點(diǎn)預(yù)選C=-1 AND REF(距前高天YA,1)<=REF(距前低天YA,1) AND 預(yù)判YXA=1 AND 小值周期>REF(大值周期,距前高天YA+1) AND 小值周期>REF(大值周期,距前高天YA) AND 小值周期>REF(小值周期,距前低天YA),-1,0); 低保留YXA:=IF(局部低點(diǎn)預(yù)選C=-1 AND REF(距前高天YA,1)>REF(距前低天YA,1) AND LLV(L,距前高天YA+1)<REF(LLV(L,距前高天YA+1),1),-1,0); 低保留YXB:=IF(局部低點(diǎn)預(yù)選C=-1 AND REF(距前高天YA,1)<=REF(距前低天YA,1) AND (距前高天YA>=4 OR LLV(缺口判斷,距前高天YA)=-1 OR 判斷YXA=-1),-1,0); 低保留YX:=IF((低保留YXA=-1 OR 低保留YXB=-1) AND L<REF(H,距前高天YA+1),-1,0); AAAD:=IF(高保留YX=1 AND 低保留YX=-1 AND H>REF(H,REF(距前高天YA,1)+2),1,IF(高保留YX=1 AND 低保留YX=-1 AND L<REF(L,REF(距前低天YA,1)+2),-1,0)); 極點(diǎn)保留:=IF(AAAD=0,高保留YX+低保留YX,AAAD); 局部極點(diǎn):IF(極點(diǎn)保留=-1,L,IF(極點(diǎn)保留=1,H,DRAWNULL)) CIRCLEDOT COLORYELLOW; DRAWLINE(極點(diǎn)保留=-1,局部極點(diǎn),極點(diǎn)保留=1,局部極點(diǎn),0)COLORLIRED; DRAWLINE(極點(diǎn)保留=1,局部極點(diǎn),極點(diǎn)保留=-1,局部極點(diǎn),0)COLORYELLOW; DD1:=BARSLAST(ABS(極點(diǎn)保留)!=1); DRAWTEXT(極點(diǎn)保留=1,局部極點(diǎn),''賣''),COLORGREEN; DRAWTEXT(極點(diǎn)保留=-1,局部極點(diǎn),''買''),COLORRED; MA5:MA(CLOSE,5),COLORFF00FF,LINETHICK2;判:IF(MA5<REF(MA5,1),MA5,DRAWNULL),COLORWHITE,LINETHICK2;
|