P:=3;
DRAWGBK(C>0,RGB(0,0,155),RGB(0,0,60),0,' ',0);
DRAwrECTREL(500,0,1000,982,RGB(0,0,155));
DRAWRECTREL(500,187.6,1000,794.4,RGB(0,55,5));
DRAWRECTREL(500,375.1,1000,606.9,RGB(0,5,55));
DRAWRECTREL(500,491,1000,491,RGB(255,00,00));
MA(C,7),COLORMAGENTA,LINETHICK2;
IF(MA(C,7)<REF(MA(C,7),1),MA(C,7),DRAWNULL),COLORLIGREEN,LINETHICK2;
DRAWBAND(MA(C,2),RGB(80,0,80),MA(C,7),RGB(0,80,0));
B1:=REF(C,1);
B2:=REF(C,2);
SS:=IF(C>REF(C,1) AND REF(C,1)>=REF(C,2),1,
IF(C>REF(C,2) AND REF(C,2)>REF(C,1),2,
IF(C<REF(C,1) AND REF(C,1)<=REF(C,2),-1,
IF(C<REF(C,2) AND REF(C,2)<REF(C,1),-2,0))));
SM:=IF(REF(SS,1)=0,REF(SS,1),
IF(REF(SS,2)=0,REF(SS,2),
IF(REF(SS,3)=0,REF(SS,3),
IF(REF(SS,5)=0,REF(SS,5),
IF(REF(SS,6)=0,REF(SS,6),
IF(REF(SS,7)=0,REF(SS,7),0))))));
STICKLINE(CLOSE>OPEN OR CLOSE=OPEN AND CLOSE>REF(CLOSE,1),LOW,HIGH,0.0,0),COLORRED;
STICKLINE(CLOSE>OPEN OR CLOSE=OPEN AND CLOSE>REF(CLOSE,1),OPEN,CLOSE,0,0),COLORRED;
STICKLINE(CLOSE<OPEN OR CLOSE=OPEN AND CLOSE<=REF(CLOSE,1),LOW,HIGH,0.0,0),COLORCYAN;
STICKLINE(CLOSE<OPEN OR CLOSE=OPEN AND CLOSE<=REF(CLOSE,1),OPEN,CLOSE,0,0),COLORCYAN;
STICKLINE(OPEN>=CLOSE ,CLOSE ,OPEN,2.5,0 ),COLOR006600;
STICKLINE(OPEN>=CLOSE ,CLOSE ,OPEN,2,0 ),COLOR00CC00;
STICKLINE(OPEN>=CLOSE ,CLOSE ,OPEN,0,0 ),COLOR00FF00;
STICKLINE(CLOSE>OPEN,CLOSE,OPEN,2.5,0) ,COLOR000066;
STICKLINE(CLOSE>OPEN,CLOSE,OPEN,2,0) ,COLOR0000CC;
STICKLINE(CLOSE>OPEN,CLOSE,OPEN,0,0) ,COLOR0000FF;
STICKLINE(SS=1 OR (SM>=1 AND SS=0),B1,C,2.5,0),COLOR0099FF;
STICKLINE(SS=2,B2,C,2.5,0),COLOR0099FF;
STICKLINE((SS=-1 OR SS=-2) AND SM>0,B2,B1,2.5,0),COLOR0099FF;
HH:=CONST(HHV(H,120));
LH:=CONST(LLV(H,120));
WN:=P;{原码 N:=3;}
WA1:=REF(H,WN)=HHV(H,2*WN+1); WB1:=FILTER(WA1,WN);
WC1:=BacKSET(WB1,WN+1);
WD1:=FILTER(WC1,WN);{高点}
WA2:=REF(L,WN)=LLV(L,2*WN+1); WB2:=FILTER(WA2,WN);
WC2:=BACKSET(WB2,WN+1);
WD2:=FILTER(WC2,WN);{低点}
WR1:=BACKSET(ISLASTBAR,BArslAST(WD1)+1); WS1:=WR1>REF(WR1,1); {前一高}
WT1:=BACKSET(ISLASTBAR,BARSLAST(WD2)+1); WU1:=WT1>REF(WT1,1); {前一低}
WR2:=BACKSET(WS1,REF(BARSLAST(WD1),1)+2); WS2:=WR2>REF(WR2,1); {前二高}
WT2:=BACKSET(WU1,REF(BARSLAST(WD2),1)+2); WU2:=WT2>REF(WT2,1); {前二低}
WR3:=BACKSET(WS2,REF(BARSLAST(WD1),1)+2); WS3:=WR3>REF(WR3,1); {前三高}
WT3:=BACKSET(WU2,REF(BARSLAST(WD2),1)+2); WU3:=WT3>REF(WT3,1); {前三低}
WR4:=BACKSET(WS3,REF(BARSLAST(WD1),1)+2); WS4:=WR4>REF(WR4,1); {前四高}
WT4:=BACKSET(WU3,REF(BARSLAST(WD2),1)+2); WU4:=WT4>REF(WT4,1); {前四高};