N1:=10;
TK:=CONST(HHVBARS(V,10)),COLOR0000FF,LINETHICK1;
量能平台:IF(CURRBARSCOUNT =N1+3,CONST(IF(TK=0,C,REF(C,TK))),DRAWNULL),COLORGRAY,LINETHICK1;
NOTEXT_新量能点:IF(CURRBARSCOUNT=TK+1,量能平台,DRAWNULL),CIRCLEDOT,COLORFFFFFF,LINETHICK9;
DRAWTEXT(ISLASTBAR,量能平台,'量能平台'),COLORGRAY;
{稳涨}
红轨道:=MA(MA(CLOSE,3),1),LINETHICK1,COLORYELLOW;
轨道:MA(MA(CLOSE,3),3),COLOR32CD32,LINETHICK2;
NOTEXT_升:IF(红轨道 =轨道,轨道,DRAWNULL),COLORMAGENTA,LINETHICK2;
{高低点定位}
G0:=(XMA(XMA(H,30),30)-XMA(XMA(L,30),30))+XMA(XMA(H,30),30);
D0:=XMA(XMA(L,30),30)-(XMA(XMA(H,30),30)-XMA(XMA(L,30),30));
G01:=(XMA(XMA(H,30),30)-XMA(XMA(L,30),30))*0.5+XMA(XMA(H,30),30);
D01:=XMA(XMA(L,30),30)-(XMA(XMA(H,30),30)-XMA(XMA(L,30),30))*0.5;
GO0:=(XMA(XMA(H,60),60)-XMA(XMA(L,60),60))*3+XMA(XMA(H,60),60);
DO0:=XMA(XMA(L,60),60)-(XMA(XMA(H,60),60)-XMA(XMA(L,60),60))*3;
STICKLINE(CURRBARSCOUNT=1,G0,G0,100,5),COLORGREEN;
STICKLINE(CURRBARSCOUNT=1,D0,D0,100,5),COLORMAGENTA;
STICKLINE(CURRBARSCOUNT=1,GO0,GO0,100,5),COLORLIBLUE;
STICKLINE(CURRBARSCOUNT=1,DO0,DO0,100,5),COLORRED;
DRAWTEXT(ISLASTBAR,G0,'卖'),COLORGREEN;
DRAWTEXT(ISLASTBAR,D0,'买'),COLORMAGENTA;
DRAWTEXT(ISLASTBAR,GO0,'顶'),COLORLIBLUE;
DRAWTEXT(ISLASTBAR,DO0,'底'),COLORRED;
{五线顺上的拐点定位线,有未来函数}
局部低点预选A:=BACKSET(LLV(L,5) REF(LLV(L,4),1),4);
局部低点预选B:=BACKSET(局部低点预选A=0 AND REF(局部低点预选A,1)=1,2);
局部低点预选C:=IF(局部低点预选B=1 AND REF(局部低点预选B,1)=0,-1,0);
局部高点预选A:=BACKSET(HHV(H,5) REF(HHV(H,4),1),4);
局部高点预选B:=BACKSET(局部高点预选A=0 AND REF(局部高点预选A,1)=1,2);
局部高点预选C:=IF(局部高点预选B=1 AND REF(局部高点预选B,1)=0,1,0);
缺口判断:=IF(L REF(H,1),1,IF(H REF(L,1),-1,0));
距前高天:=BARSLAST(局部高点预选C=1);
距前低天:=BARSLAST(局部低点预选C=-1);
小值周期:=LOWRANGE(L);
大值周期:=TOPRANGE(H);
低保留AA:=IF(局部低点预选C=-1 AND REF(距前高天,1) REF(距前低天,1) AND LLV(L,距前高天+1) REF(LLV(L,距前高天+1),1),-1,0);
低保留AB:=IF(局部低点预选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);
预判:=IF((距前低天 4 AND HHV(缺口判断,距前低天)!=1) OR REF(低保留S,距前低天)=0,1,0);
判断:=IF(局部高点预选C=1 AND REF(距前低天,1) =REF(距前高天,1) AND 预判=1 AND 大值周期 REF(小值周期,距前低天+1) AND 大值周期 REF(小值周期,距前低天) AND 大值周期 REF(大值周期,距前高天),1,0);
高保留A:=IF(局部高点预选C=1 AND REF(距前低天,1) REF(距前高天,1) AND HHV(H,距前低天+1) REF(HHV(H,距前低天+1),1),1,0);
高保留B:=IF(局部高点预选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);
预判A:=IF((距前高天 4 AND HHV(缺口判断,距前高天)!=1) OR REF(高保留,距前高天)=0,1,0);
判断A:=IF(局部低点预选C=-1 AND REF(距前高天,1) =REF(距前低天,1) AND 预判A=1 AND 小值周期 REF(大值周期,距前高天+1) AND 小值周期 REF(大值周期,距前高天) AND 小值周期 REF(小值周期,距前低天),-1,0);
低保留A:=IF(局部低点预选C=-1 AND REF(距前高天,1) REF(距前低天,1) AND LLV(L,距前高天+1) REF(LLV(L,距前高天+1),1),-1,0);
低保留B:=IF(局部低点预选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);
预判X:=IF((距前低天A 4 AND HHV(缺口判断,距前低天A)!=1) OR REF(低保留,距前低天A)=0,1,0);
判断X:=IF(局部高点预选C=1 AND REF(距前低天A,1) =REF(距前高天A,1) AND 预判X=1 AND 大值周期 REF(小值周期,距前低天A+1) AND 大值周期 REF(小值周期,距前低天A) AND 大值周期 REF(大值周期,距前高天A),1,0);
高保留XA:=IF(局部高点预选C=1 AND REF(距前低天A,1) REF(距前高天A,1) AND HHV(H,距前低天A+1) REF(HHV(H,距前低天A+1),1),1,0);
高保留XB:=IF(局部高点预选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);
预判XA:=IF((距前高天A 4 AND HHV(缺口判断,距前高天A)!=1) OR REF(高保留XA,距前高天A)=0,1,0);
判断XA:=IF(局部低点预选C=-1 AND REF(距前高天A,1) =REF(距前低天A,1) AND 预判XA=1 AND 小值周期 REF(大值周期,距前高天A+1) AND 小值周期 REF(大值周期,距前高天A) AND 小值周期 REF(小值周期,距前低天A),-1,0);
低保留XA:=IF(局部低点预选C=-1 AND REF(距前高天A,1) REF(距前低天A,1) AND LLV(L,距前高天A+1) REF(LLV(L,距前高天A+1),1),-1,0);
低保留XB:=IF(局部低点预选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);
预判YX:=IF((距前低天YA 4 AND HHV(缺口判断,距前低天YA)!=1) OR REF(低保留X,距前低天YA)=0,1,0);
判断YX:=IF(局部高点预选C=1 AND REF(距前低天YA,1) =REF(距前高天YA,1) AND 预判YX=1 AND 大值周期 REF(小值周期,距前低天YA+1) AND 大值周期 REF(小值周期,距前低天YA) AND 大值周期 REF(大值周期,距前高天YA),1,0);
高保留YXA:=IF(局部高点预选C=1 AND REF(距前低天YA,1) REF(距前高天YA,1) AND HHV(H,距前低天YA+1) REF(HHV(H,距前低天YA+1),1),1,0);
高保留YXB:=IF(局部高点预选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);
预判YXA:=IF((距前高天YA 4 AND HHV(缺口判断,距前高天YA)!=1) OR REF(高保留YXA,距前高天YA)=0,1,0);
判断YXA:=IF(局部低点预选C=-1 AND REF(距前高天YA,1) =REF(距前低天YA,1) AND 预判YXA=1 AND 小值周期 REF(大值周期,距前高天YA+1) AND 小值周期 REF(大值周期,距前高天YA) AND 小值周期 REF(小值周期,距前低天YA),-1,0);
低保留YXA:=IF(局部低点预选C=-1 AND REF(距前高天YA,1) REF(距前低天YA,1) AND LLV(L,距前高天YA+1) REF(LLV(L,距前高天YA+1),1),-1,0);
低保留YXB:=IF(局部低点预选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));
极点保留:=IF(AAAD=0,高保留YX+低保留YX,AAAD);
局部极点:IF(极点保留=-1,L,IF(极点保留=1,H,DRAWNULL)),CIRCLEDOT,COLORYELLOW;
DRAWLINE(极点保留=-1,局部极点,极点保留=1,局部极点,0)COLORLIRED,LINETHICK1;
DRAWLINE(极点保留=1,局部极点,极点保留=-1,局部极点,0)COLORLICYAN,LINETHICK1;
DD1:=BARSLAST(ABS(极点保留)!=1);
DRAWTEXT(极点保留=1,局部极点,'卖'),COLORLIBLUE;
DRAWTEXT(极点保留=-1,局部极点,'买'),COLORRED;
跌K线}
DRAWKLINE(HIGH,OPEN,LOW,CLOSE);
STICKLINE(O =C,C,O,2.6,0),COLORFF0000;
STICKLINE(O =C,C,O,1.9,0),COLORFF3300;
STICKLINE(O =C,C,O,1.2,0),COLORFF6600;
STICKLINE(O =C,C,O,0.5,0),COLORFF9900;
{涨K线}
STICKLINE(C O,C,O,2.6,0),COLOR000088;
STICKLINE(C O,C,O,1.9,0),COLOR0000AA;
STICKLINE(C O,C,O,1.2,0),COLOR0000CC;
STICKLINE(C O,C,O,0.4,0),COLOR0000EE;
DRAWTEXT_FIX(1,0.8,0,0,'www.9m8.cn'),COLORRED;