N:=1.5;
{停损止盈}
MTR:=MAX(MAX((HIGH-LOW),Abs(REF(CLOSE,1)-HIGH)),ABS(REF(CLOSE,1)-LOW));
ATR:=MA(MTR,12);
VAR1:=IF(C>=HHV(C,24) AND L>LLV(L,12),1,0);
VAR2:=IF(C<=LLV(C,24) AND H<HHV(H,12),1,0);
VAR3:=HHV(MA(H,2),24)-N*ATR;
VAR4:=LLV(MA(L,2),24)+N*ATR;
SSTOP:IF(VAR1,VAR3,REF(VAR3,BARSLAST(VAR1=1))),COLORGREEN;
XSTOP:IF(VAR2,VAR4,REF(VAR4,BARSLAST(VAR2=1))),COLORYELLOW;
{k线走向}
STICKLINE(1,H,L,0,1),COLORGRAY;
STICKLINE(C<=O,O,C,-1,0),COLORGRAY;
STICKLINE(C>O,O,C,-1,1),COLORGRAY;
AH:=C>REF(HHV(C,2),1);
STICKLINE(AH,H,L,0,1),COLORRED;
STICKLINE(AH AND C<=O,O,C,-1,0),COLORRED;
STICKLINE(AH AND C>O,O,C,-1,1),COLORRED;
BL:=C<REF(LLV(C,2),1);
STICKLINE(BL,H,L,0,1),COLORBLUE;
STICKLINE(BL AND C<=O,O,C,-1,0),COLORBLUE;
STICKLINE(BL AND C>O,O,C,-1,1),COLORBLUE;
A1:=H<=REF(H,1) AND C<REF(C,1);
A2:=C<REF(C,2);
A3:=L<REF(L,1);
STICKLINE(A1,H,L,0,1),COLORGREEN;
STICKLINE(A1 AND C<=O,O,C,-1,0),COLORGREEN;
STICKLINE(A1 AND C>O,O,C,-1,1),COLORGREEN;
STICKLINE(A1 AND A2,H,L,0,1),COLORCYAN;
STICKLINE(A1 AND A2 AND C<=O,O,C,-1,0),COLORCYAN;
STICKLINE(A1 AND A2 AND C>O,O,C,-1,1),COLORCYAN;
STICKLINE(A1 AND A2 AND A3,H,L,0,1),COLORBLUE;
STICKLINE(A1 AND A2 AND A3 AND C<=O,O,C,-1,0),COLORBLUE;
STICKLINE(A1 AND A2 AND A3 AND C>O,O,C,-1,1),COLORBLUE;
B1:=L>=REF(L,1) AND C>REF(C,1);
B2:=C>REF(C,2);
B3:=H>REF(H,1);
STICKLINE(B1,H,L,0,1),COLORYELLOW;
STICKLINE(B1 AND C<=O,O,C,-1,0),COLORYELLOW;
STICKLINE(B1 AND C>O,O,C,-1,1),COLORYELLOW;
STICKLINE(B1 AND B2,H,L,0,1),COLORMAGENTA;
STICKLINE(B1 AND B2 AND C<=O,O,C,-1,0),COLORMAGENTA;
STICKLINE(B1 AND B2 AND C>O,O,C,-1,1),COLORMAGENTA;
STICKLINE(B1 AND B2 AND B3,H,L,0,1),COLORRED;
STICKLINE(B1 AND B2 AND B3 AND C<=O,O,C,-1,0),COLORRED;
STICKLINE(B1 AND B2 AND B3 AND C>O,O,C,-1,1),COLORRED;
交易线:MA(REF((C+O)/2,1),5),COLORDF00DF;