DRAWTEXT_FIX(1,0.65,0.01,1,'说明: 如果高、低位各自动选点不对,可按ALT+T键弹出参数调整窗,进行周期微调到符合点位,缺省值为 5 ;顶底开关是开启或关闭黄色和蓝色顶、低信号之用。'),COLORYELLOW;
KDJA :=3*SMA((CLOSE-LLV(LOW,9))/(HHV(HIGH,9)-LLV(LOW,9))*100,3,1)-2*SMA(SMA((CLOSE-LLV(LOW,9))/(HHV(HIGH,9)-LLV(LOW,9))*100,3,1),3,1),NODRAW;
STICKLINE(顶底开关 0 AND (KDJA =90),CLOSE,OPEN,3,0),COLOR009CFF;
STICKLINE(顶底开关 0 AND (KDJA =90),CLOSE,OPEN,2.8,0),COLOR009CFF;
STICKLINE(顶底开关 0 AND (KDJA =90),CLOSE,OPEN,2.5,0),COLOR00C0FF;
STICKLINE(顶底开关 0 AND (KDJA =90),CLOSE,OPEN,1.5,0),COLOR00D1FF;
STICKLINE(顶底开关 0 AND (KDJA =90),CLOSE,OPEN,1,0),COLOR00EAFF;
STICKLINE(顶底开关 0 AND (KDJA =90),CLOSE,OPEN,0.7,0),COLORYELLOW;
STICKLINE(顶底开关 0 AND (KDJA =10),OPEN,CLOSE,3,0),COLORFF0000;
STICKLINE(顶底开关 0 AND (KDJA =10),OPEN,CLOSE,2.5,0),COLORFF1100;
STICKLINE(顶底开关 0 AND (KDJA =10),OPEN,CLOSE,2,0),COLORFF2200;
STICKLINE(顶底开关 0 AND (KDJA =10),OPEN,CLOSE,1.5,0),COLORFF3300;
STICKLINE(顶底开关 0 AND (KDJA =10),OPEN,CLOSE,1,0),COLORFF4400;
STICKLINE(顶底开关 0 AND (KDJA =10),OPEN,CLOSE,0.5,0),COLORFF5500;
STICKLINE(顶底开关 0 AND (KDJA =10),H,L,0,0),COLORFF6600;
A1:=REF(HIGH,周期微调)=HHV(HIGH,2*3+1);
B1:=FILTER(A1,周期微调);
C1:=BACKSET(B1,周期微调+1);
D1:=FILTER(C1,周期微调);{高点}
A2:=REF(LOW,周期微调)=LLV(LOW,2*3+1);
B2:=FILTER(A2,周期微调);
C2:=BACKSET(B2,周期微调+1);
D2:=FILTER(C2,周期微调);{低点}
E1:=(REF(LLV(LOW,2*3),1)+REF(HHV(HIGH,2*3),1))/2;
E2:=(HIGH+LOW)/2;
H1:=(D1 AND NOT(D2 AND E1 =E2)) OR ISLASTBAR OR BARSCOUNT(CLOSE)=1;
H2:=D1 AND NOT(D2 AND E1 =E2);
L1:=D2 AND NOT(D1 AND E1=E2);
X1:=REF(BARSLAST(H1),1)+1;
F1:=BACKSET(H1 AND COUNT(L1,X1) 0,LLVBARS(IF(L1,LOW,10000),X1));
G1:=F1 REF(F1,1);
I1:=BACKSET(G1,2);
LD:=I1 REF(I1,1);
L2:=LD OR ISLASTBAR OR BARSCOUNT(CLOSE)=1;
X2:=REF(BARSLAST(L2),1)+1;
F2:=BACKSET(L2 AND COUNT(H2,X2) 0,HHVBARS(IF(H2,HIGH,0),X2));
G2:=F2 REF(F2,1);
I2:=BACKSET(G2,2);
HD:=I2 REF(I2,1);
A3:=H;
B3:=REF(H,REF(BARSLAST(HD),1)+1) REF(H,REF(BARSLAST(HD),1)+2+REF(BARSLAST(HD),REF(BARSLAST(HD),1)+2));
D3:=A3 AND B3 AND HD;
E3:=BACKSET(D3,REF(BARSLAST(HD),1)+2);
HH:=E3 REF(E3,1);
A4:=L REF(L,REF(BARSLAST(LD),1)+1);
B4:=REF(L,REF(BARSLAST(LD),1)+1); D4:=A4 AND B4 AND LD;
E4:=BACKSET(D4,REF(BARSLAST(LD),1)+2);
LL:=E4 REF(E4,1);
H3:=HH OR ISLASTBAR OR BARSCOUNT(C)=1;
X3:=REF(BARSLAST(H3),1)+1;
F3:=BACKSET(H3 AND COUNT(LL,X3) 0,LLVBARS(IF(LL,L,POW(10,20)),X3));
G3:=F3 REF(F3,1);
I3:=BACKSET(G3,2);
LZ:=I3 REF(I3,1);
L4:=LZ OR ISLASTBAR OR BARSCOUNT(C)=1;
X4:=REF(BARSLAST(L4),1)+1;
F4:=BACKSET(L4 AND COUNT(HH,X4) 0,HHVBARS(IF(HH,H,-POW(10,20)),X4));
G4:=F4 REF(F4,1);
I4:=BACKSET(G4,2);
HZ:=I4 REF(I4,1);
K1:=BACKSET(ISLASTBAR,MIN(BARSLAST(HZ),BARSLAST(LZ))+1);
K2:=K1 REF(K1,1);
UU:=BACKSET(ISLASTBAR,BARSLAST(LD)+1);
VV:=UU REF(UU,1);
WW:=BACKSET(VV,REF(BARSLAST(LD),1)+2);
XX:=WW REF(WW,1);
UU2:=BACKSET(ISLASTBAR,BARSLAST(HD)+1);
VV2:=UU2 REF(UU2,1);
WW2:=BACKSET(VV2,REF(BARSLAST(HD),1)+2);
XX2:=WW2 REF(WW2,1);
高点:=BARSLAST(HD);
低点:=BARSLAST(LD);
J1:=BACKSET(ISLASTBAR,MIN(高点,低点)+1);
J2:=J1 REF(J1,1);
NOTEXT1:DRAWLINE(LD,L,HD,H,0),LINETHICK1,DOTLINE,COLOR0000FF;
NOTEXT2:DRAWLINE(HD,H,LD,L,0),LINETHICK1,DOTLINE,COLOR00FF00;
DRAWNUMBER(HD,H,H),DRAWABOVE,COLORFFFF00;
DRAWNUMBER(LD,L,L),COLOR00FFFF;
{两点买入}
高位价:REF(REF(H,高点),1),COLORRED,NODRAW;
低位价:REF(REF(L,低点),1),COLORGREEN,NODRAW;
H11:=高位价,NODRAW;
H12:=低位价,NODRAW;
L22:=DRAWNULL,NODRAW;
VVC1:=IF(高点 低点,H11,L22),NODRAW;
VVC2:=IF(LOW =低位价,H11,L22),NODRAW;
CL3:=VVC1 AND VVC2,COLOR00FFFF,NODRAW;
两点买入成立:=CL3,NODRAW;
VVD1:=IF(高点 低点,L22,H11),NODRAW;
VVD2:=IF(LOW 低位价,L22,H11),NODRAW;
CBL3:=VVD1 AND VVD2,COLORGREEN,NODRAW;
两点买入不成立:=CBL3,NODRAW;
高位价1:=IFC(CL3,H11,L22);
低位价1:=IFC(CL3,H12,L22);
VAR1:=高位价1/低位价1;
VAR2:=SQRT(SQRT(VAR1));
VAR3:=SQRT(VAR1);
VAR4:=VAR3+VAR2-1;
VAR5:=高位价1/VAR2;
VAR6:=高位价1/VAR3;
VAR7:=高位价1/VAR4;
VAR8:=REFDATE(HHV(H,高点+1),DATE);
VAR9:=REFDATE(LLV(L,低点+1),DATE);
买C1:=CONST(VAR5),NODRAW;
买C2:=CONST(VAR6),NODRAW;
买C3:=CONST(VAR7),NODRAW;
买入C1:DRAWLINE(VV2,CONST(买C1),CURRBARSCOUNT=1,买C1,1),COLORFF8800,DOTLINE;
买入C2:DRAWLINE(VV2,CONST(买C2),CURRBARSCOUNT=1,买C2,1),COLORFF8800,DOTLINE;
买入C3:DRAWLINE(VV2,CONST(买C3),CURRBARSCOUNT=1,买C3,1),COLORFF8800,DOTLINE;
DRAWTEXT(VV2,买C1,VARCAT('买C1:',VAR2STR(买C1,2))),COLORWHITE;
DRAWTEXT(VV2,买C2,VARCAT('买C2:',VAR2STR(买C2,2))),COLORWHITE;
DRAWTEXT(VV2,买C3,VARCAT('买C3:',VAR2STR(买C3,2))),COLORWHITE;
DRAWTEXT(VV,L,VARCAT('(低位)',VAR2STR(L,2))),COLORGREEN;
DRAWTEXT(VV2,H,VARCAT('(高位)',VAR2STR(H,2))),COLORRED;
STICKLINE(VV2,H,CONST(VAR7),0,-1),COLORFF8800;
DRAWLINE(VV,L,VV2,H,0),COLORFF8800,LINETHICK3;
DRAWLINE(VV2,H,CURRBARSCOUNT=1,CONST(VAR7),0),COLORFF8800,DOTLINE;
{两点卖出}
高位价2:=REF(REF(H,高点),1),NODRAW;
低位价2:=REF(REF(L,低点),1),NODRAW;
H111:=高位价2,NODRAW;
H121:=低位价2,NODRAW;
L221:=DRAWNULL,NODRAW;
H221:=高位价2,NODRAW;
H231:=低位价2,NODRAW;
VVA1:=IF(高点 低点,H121,L221)NODRAW;
VVA2:=IF(HIGH 高位价2,H111,L221);
CL1:=VVA1 AND VVA2 ,COLOR00FFFF,NODRAW;
两点卖出成立:=CL1,NODRAW,COLORYELLOW;
VVB1:=IF(高点 低点,L221,H111)NODRAW;
VVB2:=IF(HIGH 高位价2,L221,H111);
BCL1:=VVB1 AND VVB2,COLORGREEN,NODRAW;
两点卖出不成立:=BCL1,NODRAW;
高位价3:=IFC(CL1,H111,L221);
低位价3:=IFC(CL1,H121,L221);
VAR11:=高位价3/低位价3;
VAR21:=SQRT(SQRT(VAR11));
VAR31:=SQRT(VAR11);
VAR41:=VAR31+VAR21-1;
VAR51:=低位价3*VAR21;
VAR61:=低位价3*VAR31;
VAR71:=低位价3*VAR41;
卖C1:=CONST(VAR51),NODRAW;
卖C2:=CONST(VAR61),NODRAW;
卖C3:=CONST(VAR71),NODRAW;
卖出C1:DRAWLINE(VV,CONST(卖C1),CURRBARSCOUNT=1,卖C1,1),COLORMAGENTA,DOTLINE;
卖出C2:DRAWLINE(VV,CONST(卖C2),CURRBARSCOUNT=1,卖C2,1),COLORMAGENTA,DOTLINE;
卖出C3:DRAWLINE(VV,CONST(卖C3),CURRBARSCOUNT=1,卖C3,1),COLORMAGENTA,DOTLINE;
DRAWTEXT(VV,卖C1,VARCAT('卖C1:',VAR2STR(卖C1,2))),COLORYELLOW;
DRAWTEXT(VV,卖C2,VARCAT('卖C2:',VAR2STR(卖C2,2))),COLORYELLOW;
DRAWTEXT(VV,卖C3,VARCAT('卖C3:',VAR2STR(卖C3,2))),COLORYELLOW;
DRAWLINE(VV,L,CURRBARSCOUNT=1,CONST(VAR71),0),COLORMAGENTA,DOTLINE;
STICKLINE(VV,L,CONST(VAR71),0,-1),COLORMAGENTA;
DRAWLINE(VV2,H,VV,L,0),COLORMAGENTA,LINETHICK3;
{三点买入}
前高2:=BARSLAST(XX2),NODRAW;
低位2:=BARSLAST(VV),NODRAW;
次高2:=BARSLAST(VV2),NODRAW;
前低2:=BARSLAST(XX),NODRAW;
前高价:REF(REF(H,前高2),1),COLORLIRED,NODRAW;
低价:=REF(REF(L,低位2),1),COLORGREEN,NODRAW;
次高价:=REF(REF(H,次高2),1),COLORYELLOW,NODRAW;
前低价:REF(REF(L,前低2),1)COLORFFFF00,NODRAW;
MH11:=前高价,NODRAW;
MH21:=低价,NODRAW;
MH31:=次高价,NODRAW;
LY11:=前高价=0,NODRAW;
LY21:=低价=0,NODRAW;
LY31:=次高价=0,NODRAW;
VVM11:=IF(前高2 低位2,MH11,LY11)NODRAW;
VVM21:=IF(低位2 次高2,MH21,LY21)NODRAW;
VVM41:=IF(次高价 低价,MH31,LY31)NODRAW;
VVM51:=IF(LOW =MH21,MH21,LY21)NODRAW;
CL4:=VVM11 AND VVM21 AND VVM41 AND VVM51,COLOR00FFFF,NODRAW;
三点买入成立:=CL4,COLORRED,NODRAW;
VVN11:=IF(前高2 低位2,LY11,MH11)NODRAW;
VVN21:=IF(低位2 次高2,LY21,MH21)NODRAW;
VVN41:=IF(次高价 低价,LY31,MH21)NODRAW;
VVN51:=IF(LOW MH21,LY21,MH21)NODRAW;
BCL4:=VVN11 AND VVN21 AND VVN41 AND VVN51,COLORGREEN,NODRAW;
三点买入不成立:=BCL4,NODRAW;
前高价6:=IFC(CL4,MH11,LY11);
低位价6:=IFC(CL4,MH21,LY21);
次高价6:=IFC(CL4,MH31,LY31);
VARJ1:=SQRT(前高价6/低位价6);
VARJ2:=SQRT(VARJ1);
CA:=低位价6/VARJ2;
CB:=低位价6/VARJ1;
CD:=低位价6/(VARJ1+VARJ2-1);
买D1:=CONST(CA),NODRAW;
买D2:=CONST(CB),NODRAW;
买D3:=CONST(CD),NODRAW;
买入D1:DRAWLINE(VV2, CONST(CA), CURRBARSCOUNT=1, CA,1),COLORGREEN,DOTLINE;
买入D2:DRAWLINE(VV2, CONST(CB), CURRBARSCOUNT=1, CB,1),COLORGREEN,DOTLINE;
买入D3:DRAWLINE(VV2, CONST(CD), CURRBARSCOUNT=1, CD,1),COLORGREEN,DOTLINE;
DRAWTEXT(VV2,买D1,VARCAT('买D1:',VAR2STR(买D1,2))),COLORWHITE;
DRAWTEXT(VV2,买D2,VARCAT('买D2:',VAR2STR(买D2,2))),COLORWHITE;
DRAWTEXT(VV2,买D3,VARCAT('买D3:',VAR2STR(买D3,2))),COLORWHITE;
DRAWTEXT(XX2,H,VARCAT('3点(前高)',VAR2STR(H,2))),COLORLIRED;
STICKLINE(VV2,H,CONST(CD),0,-1),COLORGREEN;
IFC(CL4,DRAWLINE(XX2,H,VV,L,0),DRAWNULL)COLORGREEN,LINETHICK3;
DRAWLINE(VV,L,VV2,H,0),COLORFF8800,LINETHICK3;
DRAWLINE(VV2,H,CURRBARSCOUNT=1,CONST(买D3),1),COLORGREEN,DOTLINE;
{三点卖出}
前低:=BARSLAST(XX),NODRAW;
高位:=BARSLAST(VV2),NODRAW;
次低:=BARSLAST(VV),NODRAW;
前低价4:=REF(REF(L,前低),1),COLORGREEN,NODRAW;
高位价4:=REF(REF(H,高位),1),COLORRED,NODRAW;
次低价4:=REF(REF(L,次低),1),COLORFFFF00,NODRAW;
HH11:=前低价4,NODRAW;
HH21:=高位价4,NODRAW;
H131:=次低价4,NODRAW;
LH21:=前低价4=0,NODRAW;
L231:=高位价4=0,NODRAW;
L241:=次低价4=0,NODRAW;
VVA11:=IF(前低 高位,HH11,LH21)NODRAW;
VVA21:=IF(高位 次低,HH21,LH21)NODRAW;
VVA41:=IF(高位价4 前低价4,HH11,LH21)NODRAW;
VVA51:=IF(HIGH =HH21,HH11,LH21)NODRAW;
CL2:=VVA11 AND VVA21 AND VVA41 AND VVA51,COLOR00FFFF,NODRAW;
三点卖出成立:=CL2,NODRAW;
VVB51:=IF(前低 高位,LH21,HH11)NODRAW;
VVB61:=IF(高位 次低,LH21,HH21)NODRAW;
VVB81:=IF(高位价4 次低价4,LH21,H131)NODRAW;
VVB91:=IF(HIGH HH21,LH21,HH11)NODRAW;
BCL2:=VVB51 AND VVB61 AND VVB81 AND VVB91,COLORGREEN,NODRAW;
三点卖出不成立:=BCL2,NODRAW;
前低价5:=IFC(CL2,HH11,LH21);
高位价5:=IFC(CL2,HH21,L231);
次低价5:=IFC(CL2,H131,L231);
VARV1:=SQRT(高位价5/前低价5);
VARV2:=SQRT(VARV1);
N1:=高位价5/VARV2;
N2:=高位价5/VARV1;
N3:=高位价5/(VARV2+VARV1-1);
CF:=2*高位价5-前低价5-(N2-N3),COLORRED,NODRAW;
CG:=高位价5+(高位价5-前低价5),COLORRED,NODRAW;
CJ:=2*高位价5-前低价5+(N1-N2),COLORRED,NODRAW;
卖D1:=CONST(CF),NODRAW;
卖D2:=CONST(CG),NODRAW;
卖D3:=CONST(CJ),NODRAW;
卖出D1:IFC(BCL2,DRAWLINE(VV,CONST(CF),CURRBARSCOUNT=1,CF,1),DRAWNULL),COLORLIRED,DOTLINE;
卖出D2:IFC(BCL2,DRAWLINE(VV,CONST(CG),CURRBARSCOUNT=1,CG,1),DRAWNULL),COLORLIRED,DOTLINE;
卖出D3:IFC(BCL2,DRAWLINE(VV,CONST(CJ),CURRBARSCOUNT=1,CJ,1),DRAWNULL),COLORLIRED,DOTLINE;
DRAWTEXT(VV,卖出D1,VARCAT('卖D1:',VAR2STR(卖D1,2))),COLORWHITE;
DRAWTEXT(VV,卖出D2,VARCAT('卖D2:',VAR2STR(卖D2,2))),COLORWHITE;
DRAWTEXT(VV,卖出D3,VARCAT('卖D3:',VAR2STR(卖D3,2))),COLORWHITE;
DRAWTEXT(XX,L,VARCAT('3点(前低)',VAR2STR(L,2))),COLORFFFF00;
STICKLINE(VV,L,CONST(CJ),0,-1),COLORLIRED;
IFC(BCL2,DRAWLINE(XX,L,VV2,H,0),DRAWNULL)COLORLIRED,LINETHICK3;
DRAWLINE(VV2,H,VV,L,0),COLORMAGENTA,LINETHICK3;
DRAWLINE(VV,L,CURRBARSCOUNT=1,CONST(卖D3),1),COLORLIRED,DOTLINE;
DRAWICON(XX2,H,39);
DRAWICON(XX,L,38);
DRAWICON(VV,L,38);
DRAWICON(VV2,H,39);
预测走势:DRAWLINE(J2,IF(HD,H,L),ISLASTBAR,IF(高点 低点,H,L),0),DOTLINE,COLORFFFFFF;