周期微调:=3;
高位C:=0;
低位D:=0;
手动开关:=1;
趋势线开关:=1;
顶底开关:=1;
DRAWTEXT_FIX(1,0.72,0.003,1,'说明: 如果自动选点不对,可按ALT+T键弹出参数调整窗,进行周期微调到符合点位,缺省值为“3”;顶底开关是开启或关闭黄色顶和蓝色底的信号之用。
高位C、低位D是手动输入k线根数,进行手动预测。'),COLORYELLOW;
AR1:=BARSCOUNT(C);
AR2:=CONST(AR1);
AR3:=AR2-AR1;
K线根数:AR3+1,NODRAW,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,2.5,0),COLOR0088FF;
STICKLINE(顶底开关>0 AND (KDJA >=90),H,L,0,0),COLOR0088FF;
STICKLINE(顶底开关>0 AND (KDJA <=10),CLOSE,OPEN,2.5,0),COLORFF0000;
STICKLINE(顶底开关>0 AND (KDJA <=10),H,L,0,0),COLORFF0000;
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);
IF(趋势线开关=1,DRAWLINE(LD,L,HD,H,0),DRAWNULL)LINETHICK1,DOTLINE,COLOR0000FF;
IF(趋势线开关=1,DRAWLINE(HD,H,LD,L,0),DRAWNULL)LINETHICK1,DOTLINE,COLORYELLOW;
K:=CURRBARSCOUNT,NODRAW;
DRAWNUMBER(趋势线开关=1 AND HD,H,K),COLORLIRED,DRAWAbovE;
DRAWNUMBER(趋势线开关=1 AND LD,L,K),COLORFFFF00;
高位价:REF(REF(H,高点),1),COLORRED,NODRAW;
低位价:REF(REF(L,低点),1),COLORGREEN,NODRAW;
GGA:=IFC(高点<低点 AND 高位价>低位价 AND LOW>=低位价,高位价,DRAWNULL);
LLA:=IFC(高点<低点 AND 高位价>低位价,低位价,DRAWNULL);
PB1A:=POW(LLA,0.382)*POW(GGA,0.618);
PB2A:=SQRT(LLA*GGA);
PB3A:=POW(LLA,0.618)*POW(GGA,0.382);
PB4A:=POW(LLA,0.875)*POW(GGA,0.125);
PB1:DRAWLINE(VV2,CONST(PB1A),CURRBARSCOUNT=1,CONST(PB1A),1),COLORFF8800,DOTLINE;
PB2:DRAWLINE(VV2,CONST(PB2A),CURRBARSCOUNT=1,CONST(PB2A),1),COLORFF8800,DOTLINE;
PB3:DRAWLINE(VV2,CONST(PB3A),CURRBARSCOUNT=1,CONST(PB3A),1),COLORFF8800,DOTLINE;
PB4:DRAWLINE(VV2,CONST(PB4A),CURRBARSCOUNT=1,CONST(PB4A),1),COLORFF8800,DOTLINE;
DRAWTEXT(VV2,CONST(PB1A),VARCAT('PB1=',VAR2STR(CONST(PB1A),2))),COLORWHITE;
DRAWTEXT(VV2,CONST(PB2A),VARCAT('PB2=',VAR2STR(CONST(PB2A),2))),COLORWHITE;
DRAWTEXT(VV2,CONST(PB3A),VARCAT('PB3=',VAR2STR(CONST(PB3A),2))),COLORWHITE;
DRAWTEXT(VV2,CONST(PB4A),VARCAT('PB4=',VAR2STR(CONST(PB4A),2))),COLORWHITE;
DRAWTEXT(VV,L,VARCAT('低位【A】',VAR2STR(L,2))),COLORGREEN;
DRAWTEXT(VV2,H,VARCAT('高位【B】',VAR2STR(H,2))),COLORRED;
STICKLINE(VV2,H,CONST(PB4A),0,0),COLORFF8800;
IFC(高点<低点 AND 高位价>低位价 AND LOW>=低位价,DRAWLINE(VV,L,VV2,H,0),DRAWNULL),COLORFF8800,LINETHICK2;
DRAWLINE(VV2,H,CURRBARSCOUNT=1,CONST(PB4A),0),COLORFF8800,DOTLINE;
DRAWICON(CURRBARSCOUNT=XX,L,38);
DRAWICON(CURRBARSCOUNT=VV2,H,39);
反弹高位:=REF(REF(H,高点),1),COLORRED,NODRAW;
反弹低位:=REF(REF(L,低点),1),COLORGREEN,NODRAW;
GGB:=IFC(高点>低点 AND 反弹高位>反弹低位 AND HIGH<=反弹高位,反弹高位,DRAWNULL);
LLB:=IFC(高点>低点 AND 反弹高位>反弹低位,反弹低位,DRAWNULL);
PS1B:=POW(GGB,0.382)*POW(LLB,0.618);
PS2B:=SQRT(GGB*LLB);
PS3B:=POW(GGB,0.618)*POW(LLB,0.382);
PS4B:=POW(GGB,0.875)*POW(LLB,0.125);
PS1:DRAWLINE(VV,CONST(PS1B),CURRBARSCOUNT=1,CONST(PS1B),1),COLORMAGENTA,DOTLINE;
PS2:DRAWLINE(VV,CONST(PS2B),CURRBARSCOUNT=1,CONST(PS2B),1),COLORMAGENTA,DOTLINE;
PS3:DRAWLINE(VV,CONST(PS3B),CURRBARSCOUNT=1,CONST(PS3B),1),COLORMAGENTA,DOTLINE;
PS4:DRAWLINE(VV,CONST(PS4B),CURRBARSCOUNT=1,CONST(PS4B),1),COLORMAGENTA,DOTLINE;
DRAWTEXT(VV,CONST(PS1B),VARCAT('PS1=',VAR2STR(CONST(PS1B),2))),COLORYELLOW;
DRAWTEXT(VV,CONST(PS2B),VARCAT('PS2=',VAR2STR(CONST(PS2B),2))),COLORYELLOW;
DRAWTEXT(VV,CONST(PS3B),VARCAT('PS3=',VAR2STR(CONST(PS3B),2))),COLORYELLOW;
DRAWTEXT(VV,CONST(PS4B),VARCAT('PS4=',VAR2STR(CONST(PS4B),2))),COLORYELLOW;
DRAWLINE(VV,L,CURRBARSCOUNT=1,CONST(PS4B),0),COLORMAGENTA,DOTLINE;
STICKLINE(VV,L,CONST(PS4B),0,0),COLORMAGENTA;
IFC(高点>低点 AND 反弹高位>反弹低位 AND HIGH<=反弹高位,DRAWLINE(VV2,H,VV,L,0),DRAWNULL),COLORMAGENTA,LINETHICK2;
DRAWICON(VV,L,38);
DRAWICON(VV2,H,39);
前高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;
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;
GGC:=IFC(CL4,MH11,LY11);
LLC:=IFC(CL4,MH21,LY21);
GDC:=IFC(CL4,MH31,LY31);
VAR1:=(LLC/GGC);
HB1C:=POW(VAR1,0.618)*GDC;
HB2C:=(LLC/GGC)*GDC;
HB3C:=POW(VAR1,1.382)*GDC;
HB4C:=POW(VAR1,1.875)*GDC;
HB1:DRAWLINE(VV2,CONST(HB1C),CURRBARSCOUNT=1,CONST(HB1C),1),COLORGREEN,DOTLINE;
HB2:DRAWLINE(VV2,CONST(HB2C),CURRBARSCOUNT=1,CONST(HB2C),1),COLORGREEN,DOTLINE;
HB3:DRAWLINE(VV2,CONST(HB3C),CURRBARSCOUNT=1,CONST(HB3C),1),COLORGREEN,DOTLINE;
HB4:DRAWLINE(VV2,CONST(HB4C),CURRBARSCOUNT=1,CONST(HB4C),1),COLORGREEN,DOTLINE;
DRAWTEXT(VV2,CONST(HB1C),VARCAT('HB1=',VAR2STR(CONST(HB1C),2))),COLORWHITE;
DRAWTEXT(VV2,CONST(HB2C),VARCAT('HB2=',VAR2STR(CONST(HB2C),2))),COLORWHITE;
DRAWTEXT(VV2,CONST(HB3C),VARCAT('HB3=',VAR2STR(CONST(HB3C),2))),COLORWHITE;
DRAWTEXT(VV2,CONST(HB4C),VARCAT('HB4=',VAR2STR(CONST(HB4C),2))),COLORWHITE;
DRAWTEXT(XX2,H,VARCAT('3点(前高)',VAR2STR(H,2))),COLORLIRED;
STICKLINE(VV2,H,CONST(HB4C),0,-1),COLORGREEN;
IFC(CL4,DRAWLINE(XX2,H,VV,L,0),DRAWNULL)COLORFF8080,LINETHICK2;
IFC(CL4,DRAWLINE(VV,L,VV2,H,0),DRAWNULL)COLORFF8080,LINETHICK2;
DRAWLINE(VV2,H,CURRBARSCOUNT=1,CONST(HB4C),1),COLORGREEN,DOTLINE;
DRAWICON(XX2,H,39);
前低:=BARSLAST(XX),NODRAW;
高位:=BARSLAST(VV2),NODRAW;
次低:=BARSLAST(VV),NODRAW;
前低价3:=REF(REF(L,前低),1),COLORGREEN,NODRAW;
高位价3:=REF(REF(H,高位),1),COLORRED,NODRAW;
次低价3:=REF(REF(L,次低),1),COLORFFFF00,NODRAW;
HH11:=前低价3,NODRAW;
HH21:=高位价3,NODRAW;
H131:=次低价3,NODRAW;
LH21:=前低价3=0,NODRAW;
L231:=高位价3=0,NODRAW;
L241:=次低价3=0,NODRAW;
VVA11:=IF(前低>高位,HH11,LH21)NODRAW;
VVA21:=IF(高位>次低,HH21,LH21)NODRAW;
VVA41:=IF(高位价3>前低价3 AND 前低价3<次低价3,HH11,LH21)NODRAW;
VVA51:=IF(HIGH>=HH21,HH11,LH21)NODRAW;
CL2:=VVA11 AND VVA21 AND VVA41 AND VVA51,COLOR00FFFF,NODRAW;
三点卖出成立:=CL2,NODRAW;
GGD:=IFC(CL2,HH21,LH21);
LLD:=IFC(CL2,HH11,LH21);
LDD:=IFC(CL2,H131,L241);
VAR2:=(GGD/LLD);
HS1C:=VAR2*LDD;
HS2C:=POW(VAR2,1.382)*LDD;
HS3C:=POW(VAR2,1.618)*LDD;
HS4C:=POW(VAR2,1.875)*LDD;
HS1:DRAWLINE(VV,CONST(HS1C),CURRBARSCOUNT=1,CONST(HS1C),1),COLORLIRED,DOTLINE;
HS2:DRAWLINE(VV,CONST(HS2C),CURRBARSCOUNT=1,CONST(HS2C),1),COLORLIRED,DOTLINE;
HS3:DRAWLINE(VV,CONST(HS3C),CURRBARSCOUNT=1,CONST(HS3C),1),COLORLIRED,DOTLINE;
HS4:DRAWLINE(VV,CONST(HS4C),CURRBARSCOUNT=1,CONST(HS4C),1),COLORLIRED,DOTLINE;
DRAWTEXT(VV,CONST(HS1C),VARCAT('HS1=',VAR2STR(CONST(HS1C),2))),COLORYELLOW;
DRAWTEXT(VV,CONST(HS2C),VARCAT('HS2=',VAR2STR(CONST(HS2C),2))),COLORYELLOW;
DRAWTEXT(VV,CONST(HS3C),VARCAT('HS3=',VAR2STR(CONST(HS3C),2))),COLORYELLOW;
DRAWTEXT(VV,CONST(HS4C),VARCAT('HS4=',VAR2STR(CONST(HS4C),2))),COLORYELLOW;
DRAWTEXT(XX,L,VARCAT('3点(前低)',VAR2STR(L,2))),COLORFFFF00;
STICKLINE(VV,L,CONST(HS4C),0,-1),COLORLIRED;
IFC(CL2,DRAWLINE(XX,L,VV2,H,0),DRAWNULL),COLORYELLOW,LINETHICK2;
IFC(CL2,DRAWLINE(VV2,H,VV,L,0),DRAWNULL),COLORYELLOW,LINETHICK2;
DRAWLINE(VV,L,CURRBARSCOUNT=1,CONST(HS4C),1),COLORLIRED,DOTLINE;
DRAWICON(XX2,H,39);
DRAWICON(XX,L,38);
DRAWICON(VV,L,38);
DRAWICON(VV2,H,39);
GB2:=IF(手动开关=1,CONST(REF(H,高位C-1)),DRAWNULL),NODRAW;
LB2:=IF(手动开关=1,CONST(REF(L,低位D-1)),DRAWNULL),NODRAW;
手动高位:GB2,COLORLIRED,NODRAW;
手动低位:LB2,COLORFFFF00,NODRAW;
VVB1:=IF(高位C>低位D,GB2,DRAWNULL)NODRAW;
VVB2:=IF(高位C>低位D,LB2,DRAWNULL)NODRAW;
VVB3:=IF(GB2>LB2,GB2,DRAWNULL)NODRAW;
VVB4:=IF(GB2>LB2,LB2,DRAWNULL)NODRAW;
CB1:=VVB1 AND VVB2 AND VVB3 AND VVB4,NODRAW;
GB3:=IFC(CB1,GB2,DRAWNULL);
LB3:=IFC(CB1,LB2,DRAWNULL);
PSC1:=POW(GB3,0.382)*POW(LB3,0.618);
PSC2:=SQRT(GB3*LB3);
PSC3:=POW(GB3,0.618)*POW(LB3,0.382);
PSC4:=POW(GB3,0.875)*POW(LB3,0.125);
DRAWLINE(CURRBARSCOUNT=(低位D),CONST(PSC1),CURRBARSCOUNT=低位D-5,CONST(PSC1),0),COLORLIRED,DOTLINE;
DRAWLINE(CURRBARSCOUNT=(低位D),CONST(PSC2),CURRBARSCOUNT=低位D-6,CONST(PSC2),0),COLORLIRED,DOTLINE;
DRAWLINE(CURRBARSCOUNT=(低位D),CONST(PSC3),CURRBARSCOUNT=低位D-7,CONST(PSC3),0),COLORLIRED,DOTLINE;
DRAWLINE(CURRBARSCOUNT=(低位D),CONST(PSC4),CURRBARSCOUNT=低位D-9,CONST(PSC4),0),COLORLIRED,DOTLINE;
DRAWTEXT(CURRBARSCOUNT=低位D,CONST(PSC1),VARCAT('PS1=',VAR2STR(CONST(PSC1),2))),COLORYELLOW;
DRAWTEXT(CURRBARSCOUNT=低位D,CONST(PSC2),VARCAT('PS2=',VAR2STR(CONST(PSC2),2))),COLORYELLOW;
DRAWTEXT(CURRBARSCOUNT=低位D,CONST(PSC3),VARCAT('PS3=',VAR2STR(CONST(PSC3),2))),COLORYELLOW;
DRAWTEXT(CURRBARSCOUNT=低位D,CONST(PSC4),VARCAT('PS4=',VAR2STR(CONST(PSC4),2))),COLORYELLOW;
DRAWTEXT(CURRBARSCOUNT=高位C,H,VARCAT('高位【C】',VAR2STR(H,2))),COLORRED;
DRAWTEXT(CURRBARSCOUNT=低位D,L,VARCAT('低位【D】',VAR2STR(L,2))),COLORGREEN;
DRAWLINE(CURRBARSCOUNT=低位D,L,CURRBARSCOUNT=低位D-8,CONST(PSC4),0),COLORLIRED,DOTLINE;
IF(手动开关=1 AND GB2>LB2,DRAWLINE(CURRBARSCOUNT=高位C,H,CURRBARSCOUNT=低位D,L,0),DRAWNULL),COLORFF0080,LINETHICK3;
STICKLINE(CURRBARSCOUNT=低位D,L,CONST(PSC4),0,-1),COLORLIRED;
DRAWICON(CURRBARSCOUNT=高位C,H,39);
DRAWICON(CURRBARSCOUNT=低位D,L,38);
GC1:=IF(手动开关=1,CONST(REF(H,高位C-1)),DRAWNULL),NODRAW;
LC1:=IF(手动开关=1,CONST(REF(L,低位D-1)),DRAWNULL),NODRAW;
VVC5:=IF(高位C<低位D,GC1,DRAWNULL)NODRAW;
VVC6:=IF(高位C<低位D,LC1,DRAWNULL)NODRAW;
VVC7:=IF(GC1>LC1,GC1,DRAWNULL)NODRAW;
VVC8:=IF(GC1>LC1,LC1,DRAWNULL)NODRAW;
CC2:=VVC5 AND VVC6 AND VVC7 AND VVC8, NODRAW;
GC5:=IFC(CC2,GC1,DRAWNULL);
LC5:=IFC(CC2,LC1,DRAWNULL);
PBD1:=POW(LC5,0.382)*POW(GC5,0.618);
PBD2:=SQRT(LC5*GC5);
PBD3:=POW(LC5,0.618)*POW(GC5,0.382);
PBD4:=POW(LC5,0.875)*POW(GC5,0.125);
DRAWLINE(CURRBARSCOUNT=高位C,CONST(PBD1),CURRBARSCOUNT=高位C-5,CONST(PBD1),0),COLORGREEN,DOTLINE;
DRAWLINE(CURRBARSCOUNT=高位C,CONST(PBD2),CURRBARSCOUNT=高位C-6,CONST(PBD2),0),COLORGREEN,DOTLINE;
DRAWLINE(CURRBARSCOUNT=高位C,CONST(PBD3),CURRBARSCOUNT=高位C-7,CONST(PBD3),0),COLORGREEN,DOTLINE;
DRAWLINE(CURRBARSCOUNT=高位C,CONST(PBD4),CURRBARSCOUNT=高位C-9,CONST(PBD4),0),COLORGREEN,DOTLINE;
DRAWTEXT(CURRBARSCOUNT=高位C,CONST(PBD1),VARCAT('PB1=',VAR2STR(CONST(PBD1),2))),COLORWHITE;
DRAWTEXT(CURRBARSCOUNT=高位C,CONST(PBD2),VARCAT('PB2=',VAR2STR(CONST(PBD2),2))),COLORWHITE;
DRAWTEXT(CURRBARSCOUNT=高位C,CONST(PBD3),VARCAT('PB3=',VAR2STR(CONST(PBD3),2))),COLORWHITE;
DRAWTEXT(CURRBARSCOUNT=高位C,CONST(PBD4),VARCAT('PB4=',VAR2STR(CONST(PBD4),2))),COLORWHITE;
DRAWLINE(CURRBARSCOUNT=高位C,H,CURRBARSCOUNT=高位C-8,CONST(PBD4),0),COLORGREEN,DOTLINE;
STICKLINE(CURRBARSCOUNT=高位C,H,CONST(PBD4),0,-1),COLORGREEN;
IF(手动开关=1 AND GC1>LC1,DRAWLINE(CURRBARSCOUNT=低位D,L,CURRBARSCOUNT=高位C,H,0),DRAWNULL),COLORLIRED,LINETHICK3;
预测走势:IF(趋势线开关=1,DRAWLINE(J2,IF(HD,H,L),ISLASTBAR,IF(高点>低点,H,L),0),DRAWNULL)DOTLINE,COLORFFFFFF;