通达信自动显示波段高低点预测计算的主图指标 源码 附图
波段微调:=2;
显示开关:=1;
DRAWTEXT_FIX(1,0.30,0.00005,1,'说明: 适当改变【波段微调】参数的数值,可变动波段的位置。'),COLORYELLOW;
QS:=ZIG(1,波段微调);
低点:=TROUGHBARS(2,波段微调,1);
高点:=PEAKBARS(1,波段微调,1);
L低:=IF(低点=0,L,IF(高点<低点,TROUGH(2,波段微调,1),REF(TROUGH(2,波段微调,1),1)));
H高:=IF(高点=0,H,IF(低点<高点,PEAK(1,波段微调,1),REF(PEAK(1,波段微调,1),1)));
L低A:=IF(高点<低点 AND 显示开关=1 OR 显示开关=2,L低,DRAWNULL);
H高A:=IF(高点<低点 AND 显示开关=1 OR 显示开关=2,H高,DRAWNULL);
DRAWTEXT(低点=0,L,VARCAT('【低点】',VAR2STR(L,2))),COLORGREEN;
DRAWTEXT(高点=0,H,VARCAT('【高点】',VAR2STR(H,2))),COLORRED;
DRAWLINE(低点=0,L,高点=0,H,0)COLORRED,LINETHICK2;
DRAWLINE(高点=0,H,低点=0,L,0)COLORGREEN,LINETHICK2;
VAR1:=SQRT(H高A/L低A);
VAR2:=SQRT(VAR1);
A:=H高A/SQRT(VAR1);
B:=H高A/VAR1;
D:=H高A/(VAR1+VAR2-1);
E:=POW(L低A,0.875)*POW(H高A,0.125);
I:=H高A-(H高A-L低A)*1.236,NODRAW;
U:=H高A-(H高A-L低A)*1.618,NODRAW;
DRAWTEXT(高点=0,(A),VARCAT('C1=',VAR2STR(A,2))),COLORYELLOW;
DRAWTEXT(高点=0,(B),VARCAT('C2=',VAR2STR(B,2))),COLORYELLOW;
DRAWTEXT(高点=0,(D),VARCAT('C3=',VAR2STR(D,2))),COLORYELLOW;
DRAWTEXT(高点=0,(E),VARCAT('G4=',VAR2STR(E,2))),COLORLIRED;
DRAWTEXT(高点=0,(I),VARCAT('C5=',VAR2STR(I,2))),COLORLIRED;
DRAWTEXT(高点=0,(U),VARCAT('G6=',VAR2STR(U,2))),COLORLIRED;
STICKLINE(高点<低点,A,A,3,1),COLORFF8800;
STICKLINE(高点<低点,B,B,3,1),COLORFF8800;
STICKLINE(高点<低点,D,D,3,1),COLORFF8800;
STICKLINE(高点<低点,E,E,3,1),COLORFF8800;
STICKLINE(高点<低点,I,I,3,1),COLORFF8800;
STICKLINE(高点<低点,U,U,3,1),COLORFF8800;
STICKLINE(高点=0,H,U,0,0),COLORFF8800;
L低1:=IF(低点=0,L,IF(高点<低点,TROUGH(2,波段微调,1),REF(TROUGH(2,波段微调,1),1)));
H高1:=IF(高点=0,H,IF(低点<高点,PEAK(1,波段微调,1),REF(PEAK(1,波段微调,1),1)));
L低B:=IF(高点>低点 AND 显示开关=1 OR 显示开关=3,L低1,DRAWNULL);
H高B:=IF(高点>低点 AND 显示开关=1 OR 显示开关=3,H高1,DRAWNULL);
VAR3:=SQRT(H高B/L低B);
VAR4:=SQRT(VAR3);
F:=L低B*SQRT(VAR3),NODRAW;
G:=L低B*VAR3,NODRAW;
J:=L低B*(VAR3+VAR4-1),NODRAW;
K:=POW(H高B,0.875)*POW(L低B,0.125);
P:=L低B+(H高B-L低B)*1.236,NODRAW;
Q:=L低B+(H高B-L低B)*1.618,NODRAW;
DRAWTEXT(低点=0,(F),VARCAT('C1=',VAR2STR(F,2))),COLORWHITE;
DRAWTEXT(低点=0,(G),VARCAT('C2=',VAR2STR(G,2))),COLORWHITE;
DRAWTEXT(低点=0,(J),VARCAT('C3=',VAR2STR(J,2))),COLORWHITE;
DRAWTEXT(低点=0,(K),VARCAT('C4=',VAR2STR(K,2))),COLORGREEN;
DRAWTEXT(低点=0,(P),VARCAT('C5=',VAR2STR(P,2))),COLORGREEN;
DRAWTEXT(低点=0,(Q),VARCAT('C6=',VAR2STR(Q,2))),COLORGREEN;
STICKLINE(低点<高点,F,F,3,1),COLORMAGENTA;
STICKLINE(低点<高点,G,G,3,1),COLORMAGENTA;
STICKLINE(低点<高点,J,J,3,1),COLORMAGENTA;
STICKLINE(低点<高点,K,K,3,1),COLORMAGENTA;
STICKLINE(低点<高点,P,P,3,1),COLORMAGENTA;
STICKLINE(低点<高点,Q,Q,3,1),COLORMAGENTA;
STICKLINE(低点=0,L,Q,0,0),COLORMAGENTA;
DRAWICON(高点=0,H,39);
DRAWICON(低点=0,L,38);
未来函数检测结果如下:
该公式包含未来函数:ZIG
该公式包含未来函数:PEAK
该公式包含未来函数:PEAKBARS
该公式包含未来函数:TROUGH
该公式包含未来函数:TROUGHBARS
解密、编写股票、期货策略请联系QQ或微信同号:88652583
相关股票指标公式
原理解析:
波段微调赋值:2
显示开关赋值:1
当满足条件1时,在横轴0.30纵轴0.00005位置书写文字
QS赋值:ZIG(1,波段微调)
低点赋值:TROUGHBARS(2,波段微调,1)
高点赋值:PEAKBARS(1,波段微调,1)
L低赋值:IF(低点=0,L,IF(高点<低点,TROUGH(2,波段微调,1),REF(TROUGH(2,波段微调,1),1)))
H高赋值:IF(高点=0,H,IF(低点<高点,PEAK(1,波段微调,1),REF(PEAK(1,波段微调,1),1)))
如果高点<低点 AND 显示开关=1 OR 显示开关=2返回L低否则返回DRAWNULL
如果高点<低点 AND 显示开关=1 OR 显示开关=2返回H高否则返回DRAWNULL
DRAWTEXT(低点=0,L,VARCAT('【低点】',VAR2STR(L,2))),COLORGREEN
DRAWTEXT(高点=0,H,VARCAT('【高点】',VAR2STR(H,2))),COLORRED
DRAWLINE(低点=0,L,高点=0,H,0)COLORRED,LINETHICK2
DRAWLINE(高点=0,H,低点=0,L,0)COLORGREEN,LINETHICK2
VAR1赋值:SQRT(H高A/L低A)
VAR2赋值:SQRT(VAR1)
A赋值:H高A/SQRT(VAR1)
B赋值:H高A/VAR1
D赋值:H高A/(VAR1+VAR2-1)
E赋值:POW(L低A,0.875)*POW(H高A,0.125)
I赋值:H高A-(H高A-L低A)*1.236,NODRAW
U赋值:H高A-(H高A-L低A)*1.618,NODRAW
DRAWTEXT(高点=0,(A),VARCAT('C1=',VAR2STR(A,2))),COLORYEL最低价
DRAWTEXT(高点=0,(B),VARCAT('C2=',VAR2STR(B,2))),COLORYEL最低价
DRAWTEXT(高点=0,(D),VARCAT('C3=',VAR2STR(D,2))),COLORYEL最低价
DRAWTEXT(高点=0,(E),VARCAT('G4=',VAR2STR(E,2))),COLORLIRED
DRAWTEXT(高点=0,(I),VARCAT('C5=',VAR2STR(I,2))),COLORLIRED
DRAWTEXT(高点=0,(U),VARCAT('G6=',VAR2STR(U,2))),COLORLIRED
当满足条件高点<低点时,在A和A之间画柱状线
当满足条件高点<低点时,在B和B之间画柱状线
当满足条件高点<低点时,在D和D之间画柱状线
当满足条件高点<低点时,在E和E之间画柱状线
当满足条件高点<低点时,在I和I之间画柱状线
当满足条件高点<低点时,在U和U之间画柱状线
当满足条件高点=0时,在H和U之间画柱状线
L低1:=IF(低点=0,L,IF(高点<低点,TROUGH(2,波段微调,1),REF(TROUGH(2,波段微调,1),1)))
H高1:=IF(高点=0,H,IF(低点<高点,PEAK(1,波段微调,1),REF(PEAK(1,波段微调,1),1)))
如果高点>低点 AND 显示开关=1 OR 显示开关=3返回L低1否则返回DRAWNULL
如果高点>低点 AND 显示开关=1 OR 显示开关=3返回H高1否则返回DRAWNULL
VAR3:=SQRT(H高B/L低B)
VAR4:=SQRT(VAR3)
F赋值:L低B*SQRT(VAR3),NODRAW
G赋值:L低B*VAR3,NODRAW
J赋值:L低B*(VAR3+VAR4-1),NODRAW
K赋值:POW(H高B,0.875)*POW(L低B,0.125)
P赋值:L低B+(H高B-L低B)*1.236,NODRAW
Q赋值:L低B+(H高B-L低B)*1.618,NODRAW
DRAWTEXT(低点=0,(F),VARCAT('C1=',VAR2STR(F,2))),COLORWHITE
DRAWTEXT(低点=0,(G),VARCAT('C2=',VAR2STR(G,2))),COLORWHITE
DRAWTEXT(低点=0,(J),VARCAT('C3=',VAR2STR(J,2))),COLORWHITE
DRAWTEXT(低点=0,(K),VARCAT('C4=',VAR2STR(K,2))),COLORGREEN
DRAWTEXT(低点=0,(P),VARCAT('C5=',VAR2STR(P,2))),COLORGREEN
DRAWTEXT(低点=0,(Q),VARCAT('C6=',VAR2STR(Q,2))),COLORGREEN
当满足条件低点<高点时,在F和F之间画柱状线
当满足条件低点<高点时,在G和G之间画柱状线
当满足条件低点<高点时,在J和J之间画柱状线
当满足条件低点<高点时,在K和K之间画柱状线
当满足条件低点<高点时,在P和P之间画柱状线
当满足条件低点<高点时,在Q和Q之间画柱状线
当满足条件低点=0时,在L和Q之间画柱状线
当满足条件高点=0时,在H和39之间画图标
当满足条件低点=0时,在L和38之间画图标