AA:=1;
MID:EMA(CLOSE,17)*AA,LINETHICK1,COLORFFFFFF;
UPPER:MID+2*STD(CLOSE,17),LINETHICK1,COLOR0000FF;
LOWER:MID-2*STD(CLOSE,17),LINETHICK1,COLOR00CC00;
UPPERO:MID+3*STD(CLOSE,17),LINETHICK1,COLORFF00FF;
LOWERO:MID-3*STD(CLOSE,17),LINETHICK1,COLOR00AA00;
LOCK:=IF(TIME 1160101,1,0);
VARA:=MA(CLOSE,20);
VAR1:IF(VARA REF(VARA,2),VARA,IF(VARA REF(VARA,2),VARA,VARA)),COLOR00FF00;
IF(VARA REF(VARA,2),VARA,DRAWNULL),LINETHICK2,COLORFF00FF;
IF(VARA=REF(VARA,2),VARA,DRAWNULL),LINETHICK2,COLORFF0000;
IF(VARA REF(VARA,2),VARA,DRAWNULL),LINETHICK2,COLOR00FF00;
买入:IF(VARA REF(VARA,2) AND REF(VARA =REF(VARA,2),1),1,0),NODRAW,COLORAAAAAA;
{DRAWICON(CROSS(LOW,LOWERO),LOWERO*0.96,'红宝石');
DRAWICON(CROSS(HIGH,UPPERO),HIGH,'绿宝石');}
TY:=CLOSE;
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(CLOSE,BARSLAST(HD)); B:=REF(CLOSE,BARSLAST(LD));
T1:=BARSLAST(HD) BARSLAST(LD) AND NOT(HD) ;
T2:=BARSLAST(HD) BARSLAST(LD) AND NOT(LD);
波峰:IF(T1,A,A),COLORFF00FF,POINTDOT;
STICKLINE(T1,A,A,1.5,0),COLORFF00FF;
波谷:IF(T2,B,B),COLOR80FF00,POINTDOT;
STICKLINE(T2,B,B,1.5,0),COLOR80FF00;