VAR1:=MA(CLOSE,30);
海底: VAR1-2*STD(CLOSE,60),COLORCYAN,LINETHICK2;
水平面: MA(CLOSE,60),POINTDOT;
天际: VAR1+2*STD(CLOSE,60),;
FLY1: MA(CLOSE,5),;
FLY2: MA(CLOSE,10),;
VAR2:=CROSS(MA(CLOSE,5),MA(CLOSE,30));
DRAWICON(VAR2,LOW-LOW*0.01,1);
DRAWTEXT(VAR2 AND CLOSE>MA(CLOSE,250),LOW-LOW*0.02,'←少量买 '),COLORYELLOW;
DRAWTEXT(VAR2 AND CLOSE>=MA(CLOSE,60) AND CLOSE<=MA(CLOSE,250),LOW-LOW*0.02,'←半仓买'),COLORYELLOW;
DRAWTEXT(VAR2 AND CLOSE<MA(CLOSE,60),LOW-LOW*0.02,'←全仓买 '),COLORYELLOW;
买线:=EMA(C,2);
卖线:=EMA(SLOPE(C,21)*20+C,42);
BU:=CROSS(买线,卖线);
SEL:=CROSS(卖线,买线);
DRAWTEXT(BU,LOW*0.98,'B'),,,COLORRED;
DRAWTEXT(SEL,HIGH*1.02,'S'),,,COLORGREEN;
TY:=C;
A1:=REF(TY,10)=HHV(TY,2*10+1); B1:=FILTER(A1,10); C1:=BACKSET(B1,10+1); HD:=FILTER(C1,10);
A2:=REF(TY,10)=LLV(TY,2*10+1); B2:=FILTER(A2,10); C2:=BACKSET(B2,10+1); LD:=FILTER(C2,10);
A:=REF(C,BARSLAST(HD)); B:=REF(C,BARSLAST(LD));
T1:=BARSLAST(HD)<BARSLAST(LD) AND NOT(HD) ;
T2:=BARSLAST(HD)>BARSLAST(LD) AND NOT(LD);
波峰:IF(T1>=1,A,DRAWNULL),COLOR00FF20;
波峰射线:IF(T1<1,A,DRAWNULL),POINTDOT,COLOR00FF20;
波谷:IF(T2>=1,B,DRAWNULL),COLORFF00FF;
波谷射线:IF(T2<1,B,DRAWNULL),POINTDOT,COLORFF00FF;
YY:=(H+L+C)/3;DRAWKLINE(YY,YY,YY,YY+0.00006),COLORGREEN;