MA5:MA(C,5),COLORFFFFFF,LINETHICK1;
MA20:MA(C,20),COLORFF80FF,LINETHICK2;
MA120:MA(C,120),COLORCYAN,LINETHICK2;
角5:=ATAN((MA5/REF(MA5,1)-1)*100)*180/3.1416;
角20:ATAN((MA20/REF(MA20,1)-1)*100)*180/3.1416,NODRAW,COLORWHITE;
角120:=ATAN((MA120/REF(MA120,1)-1)*100)*180/3.1416,NODRAW,COLORWHITE;
涨幅:=(C-REF(C,1))/REF(C,1)*100;
TYP:=(HIGH+LOW+CLOSE)/3;
CCI:=(TYP-MA(TYP,14))/(0.015*AVEDEV(TYP,14));
乖离:=ABS((MA20-MA120)/MA20*100),NODRAW,COLORWHITE;
涨:=IF(REF(CCI,1)<100,CCI>120,CCI>100);
跌:=IF(REF(CCI,1)>-100,CCI<-120,CCI<-100);
震荡:=涨=0 AND 跌=0;
上:MA20+2*STD(CLOSE,20),COLOR0000FF,DOTLINE;
下:MA20-2*STD(CLOSE,20),COLOR00FF00,DOTLINE;
中上轨:上-(上-下)/6,COLORFFFF00,DOTLINE;
中下轨:下+(上-下)/6,COLORFFFF00,DOTLINE;
两格:=中上轨-MA20;
STICKLINE(涨=1,H,L,0,0),COLORRED;
STICKLINE(涨=1 AND C>=O,C,O,3,1),COLORRED;
STICKLINE(涨=1 AND C<O,C,O,3,0),COLORRED;
STICKLINE(跌=1,H,L,0,0),COLORFF6400;
STICKLINE(跌=1 AND C>=O,C,O,3,1),COLORFF6400;
STICKLINE(跌=1 AND C<O,C,O,3,0),COLORFF6400;
STICKLINE(震荡=1,H,L,0,0),COLORYELLOW;
STICKLINE(震荡=1 AND C>=O,C,O,3,1),COLORYELLOW;
STICKLINE(震荡=1 AND C<O,C,O,3,0),COLORYELLOW;
BX:=(L<=中下轨 AND 跌=0 AND LLV(L,3)>LLV(L,20) AND O-C<两格) OR (L<=下 AND 跌 AND LLV(L,3)>LLV(L,20) AND O-C<两格);
SX:=(H>=中上轨 AND 涨=0 AND HHV(H,3)<HHV(H,20) AND C-O<两格) OR (H>=上 AND 涨 AND HHV(H,3)<HHV(H,20) AND C-O<两格);
DRAWICON(BX,L,1);
DRAWICON(SX,H,2);
低吸:=(涨 AND L<上 AND HHV(CCI,3)=HHV(CCI,8)) OR (涨 AND L<中上轨) OR (震荡 AND C>MA20 AND 角20>IF(C>1000,8,20) AND L<=MA20+(上-下)/8) OR (角20>IF(C>1000,0,8) AND L<MA20-(上-下)/8) OR BX;
高抛:=(跌 AND H>下 AND LLV(CCI,3)=LLV(CCI,8)) OR (跌 AND H>中下轨) OR (震荡 AND C<MA20 AND 角20<IF(C>1000,-8,-20) AND H>=MA20-(上-下)/8) OR (角20<IF(C>1000,0,-8) AND H>MA20+(上-下)/8) OR SX;
观望:=低吸=0 AND 高抛=0;
DRAWTEXT_FIX(ISLASTBAR,0.5,0.05,0,'<使用说明> -->'),COLORRED;
DRAWTEXT_FIX(ISLASTBAR,0.57,0.05,0,'红色上涨,蓝色下跌,黄色震荡'),COLORCYAN;
DRAWTEXT_FIX(ISLASTBAR,0.5,0.1,0,'<使用说明> -->'),COLORRED;
DRAWTEXT_FIX(ISLASTBAR,0.57,0.1,0,'当买点信号出现时,先用大一级别周期确认处于低吸区域,否则买点信号真实性偏弱)'),COLORCYAN;
DRAWTEXT_FIX(ISLASTBAR AND BX,0.5,0.2,0,'<买点信号介入价格> -->'),COLORRED;
DRAWNUMBER_FIX(ISLASTBAR AND BX,0.6,0.2,0,CON2STR(IF(跌,下,中下轨),2)),COLORCYAN;
DRAWTEXT_FIX(ISLASTBAR AND BX,0.62,0.2,0,'下方或附近'),COLORRED;
DRAWTEXT_FIX(ISLASTBAR,0.5,0.15,0,'当前行情 -->'),COLORRED;
DRAWTEXT_FIX(ISLASTBAR AND 低吸,0.57,0.15,0,'当前行情处于低吸区'),COLORMAGENTA;
DRAWTEXT_FIX(ISLASTBAR AND 高抛,0.57,0.15,0,'当前行情处于高抛区'),COLORMAGENTA;
DRAWTEXT_FIX(ISLASTBAR AND 观望,0.57,0.15,0,'当前行情处于观望区,等待低吸或高抛'),COLORMAGENTA;