N:=3;M:=1;P:=10;F:=27;S:=2;
STICKLINE(C>=O,C,O,8,0),COLOR0000AA;
STICKLINE(C>=O,C,O,6,0),COLOR0000CC ;
STICKLINE(C>=O,C,O,4,0),COLOR0000DD ;
STICKLINE(C>=O,C,O,2,0),COLOR0000FF;
STICKLINE(C>=O,H,L,0,0),COLORRED;
STICKLINE(C>=O,C,O,8,0),COLOR0000AA;
STICKLINE(C>=O,C,O,6,0),COLOR0000CC ;
STICKLINE(C>=O,C,O,4,0),COLOR0000DD ;
STICKLINE(C>=O,C,O,2,0),COLOR0000FF;
STICKLINE(C>=O,H,L,0,0),COLORRED;
STICKLINE(C<=O,C,O,8,0),Color007B00;
STICKLINE(C<=O,C,O,6,0),Color009000;
STICKLINE(C<=O,C,O,4,0),Color00A800;
STICKLINE(C<=O,C,O,2,0),COLORGREEN;
STICKLINE(C<=O,H,L,0,0),COLORCYAN;
{-------------------------------------------------------------}
强弱分界: MA(CLOSE,F),linethick0,Color0000FF;
{风标: EMA((EMA(CLOSE,3)+EMA(CLOSE,5)+EMA(CLOSE,8)+EMA(CLOSE,13))/4,2),Color00FF00;}
注意卖: 强弱分界+S*STD(CLOSE,F),linethick0,ColorFF00FF;
DRAWICON(cross(H,注意卖),H+0.13 ,12);
DRAWTEXT(cross(H,注意卖),H+0.1,'→注卖'),ColorFF00FF,ALIGN0;
上极限: 强弱分界+3*STD(CLOSE,F),linethick0,ColorFF0080;
DRAWICON(cross(H,上极限),H+0.09 ,9);
DRAWTEXT(cross(H,上极限),H+0.12,'→上卖'),Color00FFFF;
{AUPPER: MID+P.7*STD(CLOSE,N);}
注意买: 强弱分界-S*STD(CLOSE,F),linethick0,Color8000FF;
{DRAWICON(cross(注意买,l),L-0.02 ,14);
DRAWTEXT(cross(注意买,L),L-0.02,'-→买'),Color00FF00;}
下极限: 强弱分界-2.9*STD(close,F),linethick0,Color4080FF;
{DRAWICON(cross(下极限,L),L-0.04 ,10);
{- }
DRAWTEXT(cross(下极限,L),L-0.06,'→下买'),Color0080FF;}
{---------------------------------------------------------}
AA:=REF(H,N)=HHV(H,2*N+1);
AAA:=FILTER(AA,N);
BB:=BacKSET(AAA,N+1);
CC1:=FILTER(BB,N);
CC:=CC1 OR ISLASTBAR;
AA2:=REF(L,N)=LLV(L,2*N+1);
AAA2:=FILTER(AA2,N);
BB2:=BACKSET(AAA2,N+1);
CC22:=FILTER(BB2,N);
CC2:=CC22 AND NOT(CC1);
EA:=BACKSET(CC,REF(BArslAST(CC2),1)+1);
EB:=EA>REF(EA,1); EE:=BACKSET(EB,2);
FF1:=EE>REF(EE,1);
EE2:=BACKSET(FF1 AND COUNT(CC,REF(BARSLAST(CC2),1)+2)=0,REF(BARSLAST(CC2),1)+2);
FF2:=EE2>REF(EE2,1);
EE3:=BACKSET(FF2 AND COUNT(CC,REF(BARSLAST(CC2),1)+2)=0,REF(BARSLAST(CC2),1)+2);
FF3:=EE3>REF(EE3,1);
JS:=IF(CC,COUNT(CC2,REF(BARSLAST(CC),1)+1),0);
G1:=IF(JS=1 AND CC,BARSLAST(FF1),0);
GA:=IF(CC AND REF(L,BARSLAST(FF1))>=REF(L,BARSLAST(FF2)),BARSLAST(FF2),BARSLAST(FF1));
G2:=IF(JS=2 AND CC,GA,0);
G3:=IF(JS>=3 AND CC,IF(CC AND REF(L,GA)>=REF(L,BARSLAST(FF3)),BARSLAST(FF3),GA),0);
GG:=G1+G2+G3;
JA:=BACKSET(CC,GG); JB:=JA>REF(JA,1); JJ:=BACKSET(JB,2);
LD:=JJ>REF(JJ,1);
LD1:=LD OR ISLASTBAR;
hEA:=BACKSET(LD1,REF(BARSLAST(CC),1)+1);
hEB:=hEA>REF(hEA,1); hEE:=BACKSET(hEB,2);
hFF1:=hEE>REF(hEE,1);
hEE2:=BACKSET(hFF1 AND COUNT(LD1,REF(BARSLAST(CC),1)+2)=0,REF(BARSLAST(CC),1)+2);
hFF2:=hEE2>REF(hEE2,1);
hEE3:=BACKSET(hFF2 AND COUNT(LD1,REF(BARSLAST(CC),1)+2)=0,REF(BARSLAST(CC),1)+2);
hFF3:=hEE3>REF(hEE3,1);
hJS:=IF(LD1,COUNT(CC1,REF(BARSLAST(LD1),1)+1),0);
hG1:=IF(hJS=1 AND LD1,BARSLAST(hFF1),0);
hGA:=IF(LD1 AND REF(H,BARSLAST(hFF1))<=REF(H,BARSLAST(hFF2)),BARSLAST(hFF2),BARSLAST(hFF1));
hG2:=IF(hJS=2 AND LD1,hGA,0);
hG3:=IF(hJS>=3 AND LD1,IF(LD1 AND REF(H,hGA)<=REF(H,BARSLAST(hFF3)),BARSLAST(hFF3),hGA),0);
hGG:=hG1+hG2+hG3;
hJA:=BACKSET(LD1,hGG); hJB:=hJA>REF(hJA,1); hJJ:=BACKSET(hJB,2);
HD:=hJJ>REF(hJJ,1);
{-------------------------------------------------------------}
DRAWICON(HD,H*1.01,10);
DRAWTEXT(HD,H+0.04,'→上卖'),Color0080FF;
DRAWICON(LD,L*0.995,11);
DRAWTEXT(LD,L-0.02,'→下买'),Color0080FF;
DRAWLINE(LD,L,HD,H,0),COLORFF9900;
DRAWLINE(HD,H,LD,L,0),COLORFF9900;
X1:=BACKSET(ISLASTBAR,BARSLAST(LD)+1);
X2:=X1>REF(X1,1);
Y1:=BACKSET(ISLASTBAR,BARSLAST(HD)+1);
Y2:=Y1>REF(Y1,1);
Z1:=IF(BARSLAST(X2)
UU:=BACKSET(ISLASTBAR,BARSLAST(LD)+1);
VV:=UU>REF(UU,1);
WW:=BACKSET(VV,REF(BARSLAST(LD),1)+2);
XX:=WW>REF(WW,1);
DRAWLINE(XX,L,VV,L,1),COLORYELLOW,POINTDOT;
UU2:=BACKSET(ISLASTBAR,BARSLAST(HD)+1);
VV2:=UU2>REF(UU2,1);
WW2:=BACKSET(VV2,REF(BARSLAST(HD),1)+2);
XX2:=WW2>REF(WW2,1);
DRAWLINE(XX2,H,VV2,H,1),COLORYELLOW,POINTDOT;
前一低:REF(L,BARSLAST(VV)),Color00FF00{,COLOR99FF66,POINTDOT},LINETHICK2;
前二低:REF(L,BARSLAST(XX)),ColorFFFFFF{,COLORFF66FF,POINTDOT},LINETHICK2;
前一高:REF(H,BARSLAST(VV2)),Color00FF00{,COLOR99FF66,POINTDOT},LINETHICK2;
前二高:REF(H,BARSLAST(XX2)),ColorFFFFFF{,COLORFF66FF,POINTDOT},LINETHICK2;
短高:=REF(H,BARSLAST(VV2)),LINETHICK0;
短低:=REF(L,BARSLAST(VV)),LINETHICK0;
短比:(C-短低)/(短高-短低),LINETHICK0;
常数:=REF(INDEXC,BARSLAST(VV))/REF(C,BARSLAST(VV));
叠1:INDEXC/常数,COLORGRAY,LINETHICK0;
PARTLINE(M,叠1),COLORGRAY;
常数2:=REF(INDEXC,BARSLAST(XX))/REF(C,BARSLAST(XX));
叠2:INDEXC/常数2,COLORGRAY,LINETHICK0;
PARTLINE(M,叠2),COLORGRAY;
{----------------------------------------------------------------}
lhnh:=BARSLAST(BARPOS=SYSPARAM(2))+1;
nnl:=BARPOS=SYSPARAM(3);
hh:=HHV(h ,lhnh);
ll:=llV(l ,lhnh);
{------------------------------------------------------}
q875:=ll+(hh-ll)*0.875;
q809:=ll+(hh-ll)*0.809;
q75:=ll+(hh-ll)*0.75;
{q625:=ll+(hh-ll)*0.625;}
q618:=ll+(hh-ll)*0.618;
q66:=ll+(hh-ll)*0.66;
q500:=ll+(hh-ll)*0.5;
{q375:=ll+(hh-ll)*0.375;}
q382:=ll+(hh-ll)*0.382;
q33:=ll+(hh-ll)*0.33;
q191:=ll+(hh-ll)*0.191;
q125:=ll+(hh-ll)*0.125;
q25:=ll+(hh-ll)*0.25;
{--------------------------------------------------------
q85:=ll+(hh-ll)*0.85;
q809:=ll+(hh-ll)*0.809;
q71:=ll+(hh-ll)*0.71;
q618:=ll+(hh-ll)*0.618;
q57:=ll+(hh-ll)*0.57;
q500:=ll+(hh-ll)*0.5;
q43:=ll+(hh-ll)*0.43;
q382:=ll+(hh-ll)*0.382;
q29:=ll+(hh-ll)*0.29;
q191:=ll+(hh-ll)*0.191;
q15:=ll+(hh-ll)*0.15;}
{------------------------------------------------------------------}
DRAWTEXT(nnl,hh*0.998,'最高价:'),ALIGN2,Color00FFFF;
drawnumber(nnl,hh*0.998,hh,2),Color00FFFF;
{DRAWTEXT(nnl,hh*0.998,'最高价:'),ALIGN2,Color00FFFF,linethick3;
drawnumber(nnl,hh*0.998,hh,2),ALIGN2,Color00FFFF,linethick3;}
DRAWTEXT(nnl,q809,'19.1%:'),ALIGN2,Color00FFFF;
drawnumber(nnl,q809,q809,2),Color00FFFF;
DRAWTEXT(nnl,q618,'38.2%:'),ALIGN2,Color00FFFF;
DRAWnumber(nnl,q618,q618,2),Color00FFFF;
DRAWTEXT(nnl,q500,'50%:'),ALIGN2,Color00FFFF;
DRAWnumber(nnl,q500,q500,2),Color00FFFF;
DRAWTEXT(nnl,q382,'61.8%:'),ALIGN2,Color00FFFF;
DRAWnumber(nnl,q382,q382,2),Color00FFFF;
DRAWTEXT(nnl,q191,'80.9%:'),ALIGN2,Color00FFFF;
DRAWnumber(nnl,q191,q191,2),Color00FFFF;
DRAWTEXT(nnl,ll*1.01,'最低价:'),ALIGN2,Color00FFFF;
DRAWnumber(nnl,ll*1.01,ll,2),Color00FFFF;
{----------------------------------------------------}
DRAWnumber(nnl,q875,q875,2),ALIGN1,ColorFF00FF;
DRAWnumber(nnl,q75,q75,2),ALIGN1,ColorFF00FF;
DRAWnumber(nnl,q66,q66,2),ALIGN1,ColorFFFFFF;
{DRAWnumber(nnl,q625,q625,2),ALIGN1,ColorFF00FF;}
{DRAWnumber(nnl,q375,q375,2),ALIGN1,ColorFF00FF;}
DRAWnumber(nnl,q33,q33,2),ALIGN1,ColorFFFFFF;
DRAWnumber(nnl,q25,q25,2),ALIGN1,ColorFF00FF;
DRAWnumber(nnl,q125,q125,2),ALIGN1,ColorFF00FF;
{----------------------------------------------------------}
DRAWTEXT(nnl,ll+(hh-ll)*0.875,' →87.5%'),ColorFF00FF,ALIGN1,linethick3;
DRAWTEXT(nnl,ll+(hh-ll)*0.75,' →75%'),ColorFF00FF,ALIGN1,linethick3;
DRAWTEXT(nnl,ll+(hh-ll)*0.66,' →甘价66%'),ColorFFFFFF,ALIGN1,linethick3;
{DRAWTEXT(nnl,ll+(hh-ll)*0.625,' →62.5%'),ColorFF00FF,ALIGN1,linethick3;
DRAWTEXT(nnl,ll+(hh-ll)*0.375,' →37.5%'),ColorFF00FF,ALIGN1,linethick3;}
DRAWTEXT(nnl,ll+(hh-ll)*0.33,' →甘价33%'),ColorFFFFFF,ALIGN1,linethick3;
DRAWTEXT(nnl,ll+(hh-ll)*0.25,' →25%'),ColorFF00FF,ALIGN1,linethick3;
DRAWTEXT(nnl,ll+(hh-ll)*0.125,' →12.5%'),ColorFF00FF,ALIGN1,linethick3;
{---------------------------------------------------------}
{DRAWTEXT(nnl,q15,' 85%:'),ALIGN1,Color00FFFF;
DRAWnumber(nnl,q85,q85,2),ALIGN1,ColorFF00FF;
DRAWnumber(nnl,q71,q71,2),ALIGN1,ColorFF00FF;
DRAWnumber(nnl,q57,q57,2),ALIGN1,ColorFF00FF;
DRAWnumber(nnl,q43,q43,2),ALIGN1,ColorFF00FF;
DRAWnumber(nnl,q29,q29,2),ALIGN1,ColorFF00FF;
DRAWnumber(nnl,q15,q15,2),ALIGN1,ColorFF00FF;
{----------------------------------------------------------}
{DRAWTEXT(nnl,ll+(hh-ll)*0.85,' →85%'),ColorFF00FF,ALIGN1,linethick3;
DRAWTEXT(nnl,ll+(hh-ll)*0.71,' →71%'),ColorFF00FF,ALIGN1,linethick3;
DRAWTEXT(nnl,ll+(hh-ll)*0.57,' →57%'),ColorFF00FF,ALIGN1,linethick3;
DRAWTEXT(nnl,ll+(hh-ll)*0.43,' →43%'),ColorFF00FF,ALIGN1,linethick3;
DRAWTEXT(nnl,ll+(hh-ll)*0.29,' →29%'),ColorFF00FF,ALIGN1,linethick3;
DRAWTEXT(nnl,ll+(hh-ll)*0.15,' →15%'),ColorFF00FF,ALIGN1,linethick3;
{----------------------------------------------------
DRAWTEXT(nnl,q15,' 85%:'),ALIGN1,Color00FFFF;}
{DRAWnumber(nnl,q85,q85,2),ALIGN1,ColorFF00FF;
DRAWnumber(nnl,q71,q71,2),ALIGN1,ColorFF00FF;
DRAWnumber(nnl,q57,q57,2),ALIGN1,ColorFF00FF;
DRAWnumber(nnl,q43,q43,2),ALIGN1,ColorFF00FF;
DRAWnumber(nnl,q29,q29,2),ALIGN1,ColorFF00FF;
DRAWnumber(nnl,q15,q15,2),ALIGN1,ColorFF00FF;
{----------------------------------------------------------}
DRAWTEXT(nnl,ll+(hh-ll)*0.85,' →85%'),ColorFF00FF,ALIGN1,linethick3;
DRAWTEXT(nnl,ll+(hh-ll)*0.71,' →71%'),ColorFF00FF,ALIGN1,linethick3;
DRAWTEXT(nnl,ll+(hh-ll)*0.57,' →57%'),ColorFF00FF,ALIGN1,linethick3;
DRAWTEXT(nnl,ll+(hh-ll)*0.43,' →43%'),ColorFF00FF,ALIGN1,linethick3;
DRAWTEXT(nnl,ll+(hh-ll)*0.29,' →29%'),ColorFF00FF,ALIGN1,linethick3;
DRAWTEXT(nnl,ll+(hh-ll)*0.15,' →15%'),ColorFF00FF,ALIGN1,linethick3;}
{---------------------------------------------------------
V1:=iSLASTbAR;
V2:=REF(H,P)=HHV(H,2*P+1);
V3:=FILTER(V2,P);
V4:=BACKSET(V3,P+1);
V5:=FILTER(V4,P);
V6:=V5 OR V1;
V7:=REF(L,N)=LLV(L,2*N+1);
V8:=FILTER(V7,P);
V9:=BACKSET(V8,P+1);
VA:=FILTER(V9,P);
VB:=VA AND NOT(V5);
VC:=BACKSET(V6,REF(BARSLAST(VB),1)+1);
VD:=VC>REF(VC,1);
VE:=BACKSET(VD,2);
VF:=VE>REF(VE,1);
V10:=BACKSET(VF AND COUNT(V6,REF(BARSLAST(VB),1)+2)=0,REF(BARSLAST(VB),1)+2);
V11:=V10>REF(V10,1);
V12:=BACKSET(V11 AND COUNT(V6,REF(BARSLAST(VB),1)+2)=0,REF(BARSLAST(VB),1)+2);
V13:=V12>REF(V12,1);
V14:=IF(V6,COUNT(VB,REF(BARSLAST(V6),1)+1),0);
V15:=IF(V14=1 AND V6,BARSLAST(VF),0);
V16:=IF(V6 AND REF(L,BARSLAST(VF))>=REF(L,BARSLAST(V11)),BARSLAST(V11),BARSLAST(VF));
V17:=IF(V14=2 AND V6,V16,0);
V18:=IF(V14>=3 AND V6,IF(V6 AND REF(L,V16)>=REF(L,BARSLAST(V13)),BARSLAST(V13),V16),0);
V19:=V15+V17+V18;
V1A:=BACKSET(V6,V19);
V1B:=V1A>REF(V1A,1);
V1C:=BACKSET(V1B,2);
V1D:=V1C>REF(V1C,1);
V1E:=V1D OR V1;
V1F:=BACKSET(V1E,REF(BARSLAST(V6),1)+1);
V20:=V1F>REF(V1F,1);
V21:=BACKSET(V20,2);
V22:=V21>REF(V21,1);
V23:=BACKSET(V22 AND COUNT(V1E,REF(BARSLAST(V6),1)+2)=0,REF(BARSLAST(V6),1)+2);
V24:=V23>REF(V23,1);
V25:=BACKSET(V24 AND COUNT(V1E,REF(BARSLAST(V6),1)+2)=0,REF(BARSLAST(V6),1)+2);
V26:=V25>REF(V25,1);
V27:=IF(V1E,COUNT(V5,REF(BARSLAST(V1E),1)+1),0);
V28:=IF(V27=1 AND V1E,BARSLAST(V22),0);
V29:=IF(V1E AND REF(H,BARSLAST(V22))<=REF(H,BARSLAST(V24)),BARSLAST(V24),BARSLAST(V22));
V2A:=IF(V27=2 AND V1E,V29,0);
V2B:=IF(V27>=3 AND V1E,IF(V1E AND REF(H,V29)<=REF(H,BARSLAST(V26)),BARSLAST(V26),V29),0);
V2C:=V28+V2A+V2B;
V2D:=BACKSET(V1E,V2C);
V2E:=V2D>REF(V2D,1);
V2F:=BACKSET(V2E,2);
V30:=V2F>REF(V2F,1);
DRAWLINE(V1D,L,V30,H,0),linethick1;
DRAWLINE(V30,H,V1D,L,0),linethick1;
{----------------------------------------------------------------}