显示开关:=1;
顶价:=REF(H,BARSLAST(H>REF(H,1)));
底价:=REF(L,BARSLAST(L分型顶0:=H>REF(顶价,1) AND L>REF(底价,1);
分型底0:=L分型顶1:=分型顶0 AND H=HHV(H,BARSLAST(分型底0));
分型底1:=分型底0 AND L=LLV(L,BARSLAST(分型顶0));
分型顶:=FILTERX(分型顶1,BARSLAST(分型底1));
分型底:=FILTERX(分型底1,BARSLAST(分型顶1));
UP1:=BARSLAST(分型底);
顶力度1:=HHV(L,UP1+1)>LLV(H,UP1+1);
顶包含1:=COUNT(L>REF(L,1),UP1)>2 AND COUNT(H>REF(H,1),UP1)>2;
DN1:=BARSLAST(分型顶);
底力度1:=HHV(L,DN1+1)>LLV(H,DN1+1);
底包含1:=COUNT(H2 AND COUNT(L2;
笔顶10:=分型顶 AND UP1>3 AND 顶力度1 AND 顶包含1;
笔底10:=分型底 AND DN1>3 AND 底力度1 AND 底包含1;
笔顶11:=笔顶10 AND H=HHV(H,BARSLAST(笔底10));
笔底11:=笔底10 AND L=LLV(L,BARSLAST(笔顶10));
笔顶12:=笔顶11 AND H=HHV(H,BARSLAST(笔底11));
笔底12:=笔底11 AND L=LLV(L,BARSLAST(笔顶11));
笔顶1:=FILTERX(笔顶12,BARSLAST(笔底12));
笔底1:=FILTERX(笔底12,BARSLAST(笔顶12));
UP2:=BARSLAST(笔底1);
顶力度2:=HHV(L,UP2+1)>LLV(H,UP2+1);
顶包含2:=COUNT(L>REF(L,1),UP2)>2 AND COUNT(H>REF(H,1),UP2)>2;
DN2:=BARSLAST(笔顶1);
底力度2:=HHV(L,DN2+1)>LLV(H,DN2+1);
底包含2:=COUNT(H2 AND COUNT(L2;
笔顶20:=分型顶 AND UP2>3 AND 顶力度2 AND 顶包含2;
笔底20:=分型底 AND DN2>3 AND 底力度2 AND 底包含2;
笔顶21:=笔顶20 AND H=HHV(H,BARSLAST(笔底20));
笔底21:=笔底20 AND L=LLV(L,BARSLAST(笔顶20));
笔顶2:=FILTERX(笔顶21,BARSLAST(笔底21));
笔底2:=FILTERX(笔底21,BARSLAST(笔顶21));
笔顶3:=笔顶1 OR 笔顶2;
笔底3:=笔底1 OR 笔底2;
笔顶41:=FILTERX(笔顶3 AND H=HHV(H,BARSLAST(笔底3)),BARSLAST(笔底3));
笔底41:=FILTERX(笔底3 AND L=LLV(L,BARSLAST(笔顶3)),BARSLAST(笔顶3));
笔顶42:=FILTERX(笔顶41 AND H=HHV(H,BARSLAST(笔底41)),BARSLAST(笔底41));
笔底42:=FILTERX(笔底41 AND L=LLV(L,BARSLAST(笔顶41)),BARSLAST(笔顶41));
笔顶431:=笔顶42 AND (BARSLAST(笔底42)>1 OR BARSLAST(笔底42)=DRAWNULL);
笔底431:=笔底42 AND (BARSLAST(笔顶42)>1 OR BARSLAST(笔顶42)=DRAWNULL);
笔顶432:=笔顶431 AND (H=HHV(H,BARSLAST(笔底431)) OR BARSLAST(笔底431)=DRAWNULL);
笔底432:=笔底431 AND (L=LLV(L,BARSLAST(笔顶431)) OR BARSLAST(笔顶431)=DRAWNULL);
笔顶43:=FILTERX(笔顶432,BARSLAST(笔底431));
笔底43:=FILTERX(笔底432,BARSLAST(笔顶431));
笔顶441:=笔顶43 AND (BARSLAST(笔底43)>2 OR BARSLAST(笔底43)=DRAWNULL);
笔底441:=笔底43 AND (BARSLAST(笔顶43)>2 OR BARSLAST(笔顶43)=DRAWNULL);
笔顶442:=笔顶441 AND (H=HHV(H,BARSLAST(笔底441)) OR BARSLAST(笔底441)=DRAWNULL);
笔底442:=笔底441 AND (L=LLV(L,BARSLAST(笔顶441)) OR BARSLAST(笔顶441)=DRAWNULL);
笔顶44:=FILTERX(笔顶442,BARSLAST(笔底441));
笔底44:=FILTERX(笔底442,BARSLAST(笔顶441));
笔顶451:=笔顶44 AND (BARSLAST(笔底44)>3 OR BARSLAST(笔底44)=DRAWNULL);
笔底451:=笔底44 AND (BARSLAST(笔顶44)>3 OR BARSLAST(笔顶44)=DRAWNULL);
笔顶452:=笔顶451 AND (H=HHV(H,BARSLAST(笔底451)) OR BARSLAST(笔底451)=DRAWNULL);
笔底452:=笔底451 AND (L=LLV(L,BARSLAST(笔顶451)) OR BARSLAST(笔顶451)=DRAWNULL);
笔顶45:=FILTERX(笔顶452,BARSLAST(笔底452));
笔底45:=FILTERX(笔底452,BARSLAST(笔顶452));
DN511:=BARSLAST(笔顶45);
底力度511:=HHV(L,DN511+1)>LLV(H,DN511+1);
底包含511:=COUNT(H2 AND COUNT(L2;
笔底511:=笔底43 AND (笔底45<>1) AND DN511>3 AND 底力度511 AND 底包含511 AND (L=LLV(L,BARSLAST(笔顶45)));
笔底51:=FILTERX(笔底511,BARSLAST(笔顶45));
UP512:=BARSLAST(笔底45);
顶力度512:=HHV(L,UP512+1)>LLV(H,UP512+1);
顶包含512:=COUNT(L>REF(L,1),UP512)>2 AND COUNT(H>REF(H,1),UP512)>2;
笔顶512:=笔顶43 AND (笔顶45<>1) AND UP512>3 AND 顶力度512 AND 顶包含512 AND (H=HHV(H,BARSLAST(笔底45)));
笔顶51:=FILTERX(笔顶512,BARSLAST(笔底45));
笔顶521:=笔顶45 OR 笔顶51;
笔底521:=笔底45 OR 笔底51;
笔顶52:=FILTERX(笔顶521 AND H=HHV(H,BARSLAST(笔底521)),BARSLAST(笔底521));
笔底52:=FILTERX(笔底521 AND L=LLV(L,BARSLAST(笔顶521)),BARSLAST(笔顶521));
UP53:=BARSLAST(笔底52);
顶力度53:=HHV(L,UP53+1)>LLV(H,UP53+1);
顶包含53:=COUNT(L>REF(L,1),UP53)>2 AND COUNT(H>REF(H,1),UP53)>2;
DN53:=BARSLAST(笔顶52);
底力度53:=HHV(L,DN53+1)>LLV(H,DN53+1);
底包含53:=COUNT(H2 AND COUNT(L2;
笔顶53:=笔顶52 AND UP53>3 AND 顶力度53 AND 顶包含53 AND (H=HHV(H,BARSLAST(笔底52)));
笔底53:=笔底52 AND DN53>3 AND 底力度53 AND 底包含53 AND (L=LLV(L,BARSLAST(笔顶52)));
笔顶54:=FILTERX(笔顶53 AND H=HHV(H,BARSLAST(笔底53)),BARSLAST(笔底53));
笔底54:=FILTERX(笔底53 AND L=LLV(L,BARSLAST(笔顶53)),BARSLAST(笔顶53));
笔顶55:={分型顶 AND}H=HHV(H,BARSLAST(笔底54)) AND L>LLV(L,BARSLAST(笔底54)) AND BARSLAST(笔顶54)
笔底56:=笔底54 OR 笔底55;
笔顶6:=FILTERX(笔顶56 AND H=HHV(H,BARSLAST(笔底56)),BARSLAST(笔底56));
笔底6:=FILTERX(笔底56 AND L=LLV(L,BARSLAST(笔顶56)),BARSLAST(笔顶56));
笔顶7:=笔顶6 AND BARSLAST(笔底6)>3;
笔底7:=笔底6 AND BARSLAST(笔顶6)>3;
笔顶:=BARSLAST(笔顶6),NODRAW;
笔底:=BARSLAST(笔底6),NODRAW;
NOTEXT_上笔:DRAWLINE(笔底=0,L,笔顶=0,H,0),COLORGREEN,LINETHICK2;
NOTEXT_下笔:DRAWLINE(笔顶=0,H,笔底=0,L,0),COLOR0000FF,LINETHICK2;
L低:=REF(L,笔底);
H高:=REF(H,笔顶);
L低A:=IF(笔顶<笔底 AND 显示开关=1 OR 显示开关=2,L低,DRAWNULL);
H高A:=IF(笔顶<笔底 AND 显示开关=1 OR 显示开关=2,H高,DRAWNULL);
PB1A:=POW(L低A,0.382)*POW(H高A,0.618);
PB2A:=SQRT(L低A*H高A);
PB3A:=POW(L低A,0.618)*POW(H高,0.382);
PB4A:=POW(L低A,0.875)*POW(H高A,0.125);
PB5A:=H高A-(H高A-L低A)*1.236,NODRAW;
PB6A:=H高A-(H高A-L低A)*1.618,NODRAW;
DRAWTEXT(笔顶,(PB1A),VARCAT('PB1=',VAR2STR(PB1A,2))),COLORYELLOW;
DRAWTEXT(笔顶,(PB2A),VARCAT('PB2=',VAR2STR(PB2A,2))),COLORYELLOW;
DRAWTEXT(笔顶,(PB3A),VARCAT('PB3=',VAR2STR(PB3A,2))),COLORYELLOW;
DRAWTEXT(笔顶,(PB4A),VARCAT('PB4=',VAR2STR(PB4A,2))),COLORYELLOW;
DRAWTEXT(笔顶,(PB5A),VARCAT('PB5=',VAR2STR(PB5A,2))),COLORYELLOW;
DRAWTEXT(笔顶,(PB6A),VARCAT('PB6=',VAR2STR(PB6A,2))),COLORYELLOW;
STICKLINE(笔顶<笔底,PB1A,PB1A,3,1),COLORFF8800;
STICKLINE(笔顶<笔底,PB2A,PB2A,3,1),COLORFF8800;
STICKLINE(笔顶<笔底,PB3A,PB3A,3,1),COLORFF8800;
STICKLINE(笔顶<笔底,PB4A,PB4A,3,1),COLORFF8800;
STICKLINE(笔顶<笔底,PB5A,PB5A,3,1),COLORFF8800;
STICKLINE(笔顶<笔底,PB6A,PB6A,3,1),COLORFF8800;
STICKLINE(笔顶=0,H,PB6A,0,0),COLORFF8800;
L低B:=IF(笔顶>笔底 AND 显示开关=1 OR 显示开关=3,L低,DRAWNULL);
H高B:=IF(笔顶>笔底 AND 显示开关=1 OR 显示开关=3,H高,DRAWNULL);
PS1B:=POW(H高B,0.382)*POW(L低B,0.618);
PS2B:=SQRT(H高B*L低B);
PS3B:=POW(H高B,0.618)*POW(L低B,0.382);
PS4B:=POW(H高B,0.875)*POW(L低B,0.125);
PS5B:=L低B+(H高B-L低B)*1.236,NODRAW;
PS6B:=L低B+(H高B-L低B)*1.618,NODRAW;
DRAWTEXT(笔底,(PS1B),VARCAT('PS1=',VAR2STR(PS1B,2))),COLORWHITE;
DRAWTEXT(笔底,(PS2B),VARCAT('PS2=',VAR2STR(PS2B,2))),COLORWHITE;
DRAWTEXT(笔底,(PS3B),VARCAT('PS3=',VAR2STR(PS3B,2))),COLORWHITE;
DRAWTEXT(笔底,(PS4B),VARCAT('PS4=',VAR2STR(PS4B,2))),COLORWHITE;
DRAWTEXT(笔底,(PS5B),VARCAT('PS5=',VAR2STR(PS5B,2))),COLORWHITE;
DRAWTEXT(笔底,(PS6B),VARCAT('PS6=',VAR2STR(PS6B,2))),COLORWHITE;
STICKLINE(笔顶>笔底,PS1B,PS1B,3,1),COLORMAGENTA;
STICKLINE(笔顶>笔底,PS2B,PS2B,3,1),COLORMAGENTA;
STICKLINE(笔顶>笔底,PS3B,PS3B,3,1),COLORMAGENTA;
STICKLINE(笔顶>笔底,PS4B,PS4B,3,1),COLORMAGENTA;
STICKLINE(笔顶>笔底,PS5B,PS5B,3,1),COLORMAGENTA;
STICKLINE(笔顶>笔底,PS6B,PS6B,3,1),COLORMAGENTA;
STICKLINE(笔底=0,L,PS6B,0,0),COLORMAGENTA;
DRAWTEXT(笔底=0,L,VARCAT('【低点】',VAR2STR(底价,2))),COLORGREEN;
DRAWTEXT(笔顶=0,H,VARCAT('【高点】',VAR2STR(顶价,2))),COLORRED;
DRAWICON(笔顶=0,H,2);
DRAWICON(笔底=0,L,1);