输入几个K线根数就自动显示拐点的《神奇时间拐点》指标 主图源码

A起点:=0;
A低点:=0;
A高点:=0;
A次低:=0;
B高点:=0;
C低点:=0;
D高点:=0;
买入低位:=0;
买入高位:=0;
卖出高位:=0;
卖出低位:=0;
手动开关:=1;
DRAWTEXT_FIX(1,0.70,0.01,1,'说明: 打开指标参数调整窗,参考趋势线上的K线根数值,填进选择的高、低点位的K线根数相应位置,就会自动显示A、B、C、D四根拐点位置的竖线,两点手动空间预测是辅助拐点预测之用。'),COLORYELLOW;
AR1:=BARSCOUNT(C);
AR2:=CONST(AR1);
AR3:=AR2-AR1;
K线根数:AR3+1,NODRAW,COLORYELLOW;
A1:=(REF(HIGH,3)=HHV(HIGH,(2*3+1)));
B1:=FILTER(A1,3);
C1:=BACKSET(B1,(3+1));
D1:=FILTER(C1,3);
A2:=(REF(LOW,3)=LLV(LOW,(2*3+1)));
B2:=FILTER(A2,3);
C2:=BACKSET(B2,(3+1));
D2:=FILTER(C2,3);
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);
DRAWLINE(LD,L,HD,H,0),LINETHICK1,DOTLINE,COLOR0000FF;
DRAWLINE(HD,H,LD,L,0),LINETHICK1,DOTLINE,COLOR00FF00;
K:=CURRBARSCOUNT,NODRAW;
DRAWNUMBER(HD,H,K),COLORLIRED,DRAWABOVE;
DRAWNUMBER(LD,L,K),COLORFFFF00;
高点:=BARSLAST(HD);
低点:=BARSLAST(LD);
J1:=BACKSET(ISLASTBAR,MIN(高点,低点)+1);
J2:=J1>REF(J1,1);

起点A:=BARSLAST(CURRBARSCOUNT=A起点+1),NODRAW;
低点A:=BARSLAST(CURRBARSCOUNT=A低点+1),NODRAW;
高点A:=BARSLAST(CURRBARSCOUNT=A高点+1),NODRAW;
次低A:=BARSLAST(CURRBARSCOUNT=A次低+1),COLORFF8800,NODRAW;
高点B:=BARSLAST(CURRBARSCOUNT=B高点+1),COLORFF0080,NODRAW;
低点C:=BARSLAST(CURRBARSCOUNT=C低点+1),NODRAW;
高点D:=BARSLAST(CURRBARSCOUNT=D高点+1),NODRAW;

起点:1,COLORRED,NODRAW;
TA1:ABS(起点A-低点A+1),COLORGREEN,NODRAW;
TA2:ABS(起点A-高点A)+1,COLORRED,NODRAW;
TA3:ABS(起点A-次低A)+1,COLORGREEN,NODRAW;
TB4:IF(B高点>0,ABS(起点A-高点B)+1,DRAWNULL)COLORFF8800,NODRAW;
TC5:IF(C低点>0,ABS(起点A-低点C)+1,DRAWNULL)COLORLIRED,NODRAW;
TD6:IF(D高点>0,ABS(起点A-高点D)+1,DRAWNULL)COLORRED,NODRAW;

TB1:=TA3*TA2,NODRAW;
拐点A:INTPART(TB1/TA1),COLORYELLOW,NODRAW;
TB2:=TB4*TA3,NODRAW;
拐点B:INTPART(TB2/TA2),COLORMAGENTA,NODRAW;
TB3:=TC5*TB4,NODRAW;
拐点C:INTPART(TB3/TA3),COLORLIRED,NODRAW;
TB5:=TD6*TC5,NODRAW;
拐点D:INTPART(TB5/TB4),COLORGREEN,NODRAW;

STICKLINE(CURRBARSCOUNT=A起点-拐点A+1,H*1.5,L*0.95,0.05,-1),COLORFF9900;
STICKLINE(CURRBARSCOUNT=A起点-拐点B+1,H*1.5,L*0.95,0.05,-1),COLORMAGENTA;
STICKLINE(CURRBARSCOUNT=A起点-拐点C+1,H*1.5,L*0.95,0.05,-1),COLORYELLOW;
STICKLINE(CURRBARSCOUNT=A起点-拐点D+1,H*1.5,L*0.95,0.05,-1),COLORGREEN;

STICKLINE(CURRBARSCOUNT=A起点-拐点A+1,H,L,3.0,0),COLORFF9900;
STICKLINE(CURRBARSCOUNT=A起点-拐点B+1,H,L,3.0,0),COLORYELLOW;
STICKLINE(CURRBARSCOUNT=A起点-拐点C+1,H,L,3.0,0),COLORLIRED;
STICKLINE(CURRBARSCOUNT=A起点-拐点D+1,H,L,3.0,0),COLORFF0080;

DRAWLINE(CURRBARSCOUNT=A起点,H,CURRBARSCOUNT=A低点,L,0),COLORYELLOW,LINETHICK2;
DRAWLINE(CURRBARSCOUNT=A低点,L,CURRBARSCOUNT=A高点,H,0),COLORYELLOW,LINETHICK2;
DRAWLINE(CURRBARSCOUNT=A高点,H,CURRBARSCOUNT=A次低,L,0),COLORYELLOW,LINETHICK2;
DRAWLINE(CURRBARSCOUNT=A次低,L,CURRBARSCOUNT=B高点,H,0),COLORFF7700,LINETHICK2;
DRAWLINE(CURRBARSCOUNT=B高点,H,CURRBARSCOUNT=C低点,L,0),COLORGREEN,LINETHICK2;
DRAWLINE(CURRBARSCOUNT=C低点,L,CURRBARSCOUNT=D高点,H,0),COLORLIRED,LINETHICK2;

DRAWTEXT(CURRBARSCOUNT=A起点,H*1.01,VARCAT(('【起点】='),VAR2STR(1,0))),COLORRED,COLORRED;
DRAWTEXT(CURRBARSCOUNT=A低点,L*0.99,VARCAT(('【TA1】='),VAR2STR(TA1,0))),COLORRED,COLORGREEN;
DRAWTEXT(CURRBARSCOUNT=A高点,H*1.01,VARCAT(('【TA2】='),VAR2STR(TA2,0))),COLORRED,COLORGREEN;
DRAWTEXT(CURRBARSCOUNT=A次低,L*0.99,VARCAT(('【TA3】='),VAR2STR(TA3,0))),COLORRED,COLORGREEN;
DRAWTEXT(CURRBARSCOUNT=B高点,H*1.01,VARCAT(('【TB4】='),VAR2STR(TB4,0))),COLORRED,COLORRED;
DRAWTEXT(CURRBARSCOUNT=C低点,L*0.99,VARCAT(('【TC5】='),VAR2STR(TC5,0))),COLORRED,COLORFF8800;
DRAWTEXT(CURRBARSCOUNT=D高点,H*1.01,VARCAT(('【TD6】='),VAR2STR(TD6,0))),COLORRED,COLORYELLOW;

DRAWTEXT(CURRBARSCOUNT=A起点-拐点A+1,L*0.95,VARCAT(('拐点A='),VAR2STR(拐点A,0))),COLORYELLOW;
DRAWTEXT(CURRBARSCOUNT=A起点-拐点B+1,L*0.95,VARCAT(('拐点B='),VAR2STR(拐点B,0))),COLORMAGENTA;
DRAWTEXT(CURRBARSCOUNT=A起点-拐点C+1,L*0.95,VARCAT(('拐点C='),VAR2STR(拐点C,0))),COLORLIRED;
DRAWTEXT(CURRBARSCOUNT=A起点-拐点D+1,L*0.95,VARCAT(('拐点D='),VAR2STR(拐点D,0))),COLORWHITE;
DRAWICON(CURRBARSCOUNT=A起点,H,23);

LL1A:=REF(L,买入低位-1),NODRAW;
GG1A:=REF(H,买入高位-1),NODRAW;
LL1:=IF(手动开关=1 AND 买入低位>买入高位 AND GG1A>LL1A,LL1A,DRAWNULL),NODRAW;
GG1:=IF(手动开关=1 AND 买入低位>买入高位 AND GG1A>LL1A,GG1A,DRAWNULL),NODRAW;
VAR1A:=SQRT(GG1/LL1);
VAR2A:=SQRT(VAR1A);
A:=GG1/SQRT(VAR1A);
B:=GG1/VAR1A;
D:=GG1/(VAR1A+VAR2A-1);
{买C1A:CONST(A),COLORFF8800,NODRAW;
买C2A:CONST(B),COLORFF8800,NODRAW;
买C3A:CONST(D),COLORFF8800,NODRAW;}

IF(手动开关=1,DRAWLINE(CURRBARSCOUNT=买入低位,L,CURRBARSCOUNT=买入高位,H,0),DRAWNULL),COLORGREEN,LINETHICK3;
买C1:DRAWLINE(CURRBARSCOUNT=买入高位,CONST(A),CURRBARSCOUNT=1,CONST(A),1),COLORFF8800,DOTLINE;
买C2:DRAWLINE(CURRBARSCOUNT=买入高位,CONST(B),CURRBARSCOUNT=1,CONST(B),1),COLORFF8800,DOTLINE;
买C3:DRAWLINE(CURRBARSCOUNT=买入高位,CONST(D),CURRBARSCOUNT=1,CONST(D),1),COLORFF8800,DOTLINE;

DRAWTEXT(CURRBARSCOUNT=买入高位,CONST(A),VARCAT('买C1=',VAR2STR(CONST(A),2))),COLORWHITE;
DRAWTEXT(CURRBARSCOUNT=买入高位,CONST(B),VARCAT('买C2=',VAR2STR(CONST(B),2))),COLORWHITE;
DRAWTEXT(CURRBARSCOUNT=买入高位,CONST(D),VARCAT('买C3=',VAR2STR(CONST(D),2))),COLORWHITE;
DRAWTEXT(CURRBARSCOUNT=买入低位,L,VARCAT('低位【A】',VAR2STR(L,2))),COLORGREEN;
DRAWTEXT(CURRBARSCOUNT=买入高位,H,VARCAT('高位【B】',VAR2STR(H,2))),COLORRED;
STICKLINE(CURRBARSCOUNT=买入高位,H,CONST(D),0,-1),COLORFF8800;

GGB2:=REF(H,卖出高位-1),NODRAW;
LLB2:=REF(L,卖出低位-1),NODRAW;
GG3:=IF(手动开关=1 AND 卖出高位>卖出低位 AND GGB2>LLB2,GGB2,DRAWNULL),NODRAW;
LL3:=IF(手动开关=1 AND 卖出高位>卖出低位 AND GGB2>LLB2,LLB2,DRAWNULL),NODRAW;
VAR1C:=SQRT(GG3/LL3);
VAR2C:=SQRT(VAR1C);
F:=LL3*SQRT(VAR1C),NODRAW;
G:=LL3*VAR1C,NODRAW;
J:=LL3*(VAR1C+VAR2C-1),NODRAW;
{卖C1A:CONST(F),COLORMAGENTA,NODRAW;
卖C2A:CONST(G),COLORMAGENTA,NODRAW;
卖C3A:CONST(J),COLORMAGENTA,NODRAW;}
IF(手动开关=1,DRAWLINE(CURRBARSCOUNT=卖出高位,H,CURRBARSCOUNT=卖出低位,L,0),DRAWNULL),COLORMAGENTA,LINETHICK3;
卖C1:DRAWLINE(CURRBARSCOUNT=卖出低位, CONST(F), CURRBARSCOUNT=1,CONST(F),1),COLORMAGENTA,DOTLINE;
卖C2:DRAWLINE(CURRBARSCOUNT=卖出低位, CONST(G), CURRBARSCOUNT=1,CONST(G),1),COLORMAGENTA,DOTLINE;
卖C3:DRAWLINE(CURRBARSCOUNT=卖出低位, CONST(J), CURRBARSCOUNT=1,CONST(J),1),COLORMAGENTA,DOTLINE;
DRAWTEXT(CURRBARSCOUNT=卖出低位, CONST(F),VARCAT('卖C1=',VAR2STR(CONST(F),2))),COLORYELLOW;
DRAWTEXT(CURRBARSCOUNT=卖出低位, CONST(G),VARCAT('卖C2=',VAR2STR(CONST(G),2))),COLORYELLOW;
DRAWTEXT(CURRBARSCOUNT=卖出低位, CONST(J),VARCAT('卖C3=',VAR2STR(CONST(J),2))),COLORYELLOW;
DRAWTEXT(CURRBARSCOUNT=卖出高位,H,VARCAT('高位【A】',VAR2STR(H,2))),COLORRED;
DRAWTEXT(CURRBARSCOUNT=卖出低位,L,VARCAT('低位【B】',VAR2STR(L,2))),COLORGREEN;
STICKLINE(CURRBARSCOUNT=卖出低位,H,CONST(J),0,4),COLORMAGENTA;
预测走势:DRAWLINE(J2,IF(HD,H,L),ISLASTBAR,IF(高点>低点,H,L),0),DOTLINE,COLORFFFFFF;




未来函数检测结果如下:
该公式包含未来函数:BACKSET
解密、编写股票、期货策略请联系QQ或微信同号:88652583
相关股票指标公式

联系我们  |  指标公式网  |  指标网   |  指标公式  |   加入收藏   |  设为主页

@2005-2023 浙ICP备2024071487号-2 指标公式网别名指标网仅为互联网文章,所有指标公式及文章仅供学习研究,并不构成投资建议,请勿以此为依据进行股票交易,由此引起的投资亏损与本站无关。指标公式网均来源互联网收集整理,如不慎侵犯了你的权益,请联系我们告知,我们将做删除处理
QQ:88652583 微信 88652583
sitemap站点地图