智能趋势画线自动画线工具通达信公式 主图 源码附图
HIGHN:=10;LOWN:=10;HIGHDISPLAY:=0;LOWDISPLAY:=0;ZGDISPLAY:=0;MADISPLAY:=0;
AAB:=REF(H,HIGHN)=HHV(H,2*HIGHN+1);
QY:=BACKSET(AAB,HIGHN+1);
CC:=FILTER(QY,HIGHN) AND H=HHV(H,HIGHN+1);
DRAWICON(CC,H*1.02,2);
DDD:=BARSLAST(CC);
GDTS:=IF(CC,CURRBARSCOUNT,0);
DINGBU:=IF(DDD,REF(H,DDD),H);
DINGBUTS:=IF(DDD,REF(GDTS,DDD),GDTS);
DINGBU1:=REF(DINGBU,DDD+1);
GDCS1:=CONST(DINGBUTS);
DINGBUTS1:=REF(DINGBUTS,DDD+1);
GDCS2:=CONST(DINGBUTS1);
DINGBU2:=REF(DINGBU1,DDD+1);
MMM:=IF(CURRBARSCOUNT>GDCS2,0,1);
高点压力:DRAWLINE(CURRBARSCOUNT=GDCS2,H,CURRBARSCOUNT=GDCS1,H,1) COLORGREEN,DOTLINE;
压力A:DRAWLINE(CURRBARSCOUNT=GDCS2,H,ISLASTBAR,REF(H,GDCS2-1),1),COLOR0055FF,DOTLINE;
压力B:DRAWLINE(CURRBARSCOUNT=GDCS1,H,ISLASTBAR,REF(H,GDCS1-1),1),COLORYELLOW,DOTLINE;
DRAWTEXT_FIX(1,0.980,20,1,'★股票指标网'),COLOR666666;
AA1:=REF(L,LOWN)=LLV(L,2*LOWN+1);
QY1:=BACKSET(AA1,LOWN+1);
CC1:=FILTER(QY1,LOWN) AND L=LLV(L,LOWN+1);
DD1:=BARSLAST(CC1);
DDTS:=IF(CC1,CURRBARSCOUNT,0);
YDB:=IF(DD1,REF(L,DD1),L);
DDTS1:=IF(DD1,REF(DDTS,DD1),DDTS);
DDCS1:=CONST(DDTS1);
ZDB:=REF(YDB,DD1+1);
DDTS2:=REF(DDTS1,DD1+1);
DDCS2:=CONST(DDTS2);
低点支撑:DRAWLINE(CURRBARSCOUNT=DDCS2,L,CURRBARSCOUNT=DDCS1,L,1) COLORRED,DOTLINE;
ZGSTAR:=(高点压力+低点支撑)/2;
ZGEND:=CONST((高点压力+低点支撑)/2);
STARDAY:=IF(DDCS2<GDCS2,DDCS2,GDCS2);
中轨:DRAWLINE(CURRBARSCOUNT=STARDAY,ZGSTAR,ISLASTBAR,ZGEND,1),POINTDOT,COLORFFBBFF,LINETHICK1;
TTT:=6;
A1:=REF(HIGH,6)=HHV(HIGH,2*TTT+1); B1:=FILTER(A1,TTT); C1:=BACKSET(B1,TTT+1); D1:=FILTER(C1,TTT);
A2:=REF(LOW,TTT)=LLV(LOW,2*TTT+1); B2:=FILTER(A2,TTT); C2:=BACKSET(B2,TTT+1); D2:=FILTER(C2,TTT);
E1:=(REF(LLV(LOW,2*TTT),1)+REF(HHV(HIGH,2*TTT),1))/2; E2:=(HIGH+LOW)/2;
H1:=(D1 AND NOT(D2 AND E1>=E2)) OR BARSTATUS OR BARSCOUNT(CLOSE)=1;
L1:=(D2 AND NOT(D1 AND E1<E2)); H2:=D1 AND NOT(D2 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 BARSTATUS 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);
UU:=BACKSET(BARSTATUS,BARSLAST(LD)+1);
VV:=UU>REF(UU,1);
WW:=BACKSET(VV,REF(BARSLAST(LD),1)+2);
XX:=WW>REF(WW,1);
UU2:=BACKSET(BARSTATUS,BARSLAST(HD)+1);
VV2:=UU2>REF(UU2,1);
WW2:=BACKSET(VV2,REF(BARSLAST(HD),1)+2);
XX2:=WW2>REF(WW2,1);
近低A:REF(L,BARSLAST(VV)),COLORWHITE,LINETHICK1,DOTLINE;
近低B:REF(L,BARSLAST(XX)),COLORMAGENTA,DOTLINE;
DRAWTEXT(CURRBARSCOUNT=2,高点压力,STRCAT('压力延伸:',CON2STR(高点压力,2))),COLORYELLOW;
DRAWTEXT(CURRBARSCOUNT=2,低点支撑,STRCAT('支撑延伸:',CON2STR(低点支撑,2))),COLORYELLOW;
DRAWTEXT(CURRBARSCOUNT=2,中轨,STRCAT('中轨:',CON2STR(中轨,2))),COLORYELLOW;
DRAWTEXT(CURRBARSCOUNT=2,压力A,STRCAT('压力A:',CON2STR(压力A,2))),COLORYELLOW;
DRAWTEXT(CURRBARSCOUNT=2,压力B,STRCAT('压力B:',CON2STR(压力B,2))),COLORYELLOW;
DRAWTEXT(CURRBARSCOUNT=2,近低A,STRCAT('←近低A:',CON2STR(近低A,2))),COLORWHITE;
DRAWTEXT(CURRBARSCOUNT=2,近低B,STRCAT('←近低B:',CON2STR(近低B,2))),COLORMAGENTA;
未来函数检测结果如下:
该公式包含未来函数:BACKSET
解密、编写股票、期货策略请联系QQ或微信同号:88652583
相关股票指标公式
原理解析:
HIGHN赋值:10
LOWN赋值:10
HIGHDISPLAY赋值:0
LOWDISPLAY赋值:0
ZGDISPLAY赋值:0
MADISPLAY赋值:0
AAB赋值:HIGHN日前的H=2*HIGHN+1日内H最高值
QY赋值:BACKSET(AAB,HIGHN+1)
CC赋值:QY的HIGHN过滤 AND H=HIGHN+1日内H最高值
当满足条件CC时,在H*1.02和2之间画图标
DDD赋值:上次CC距今天数
如果CC返回 到最后交易的周期否则返回0
DINGBU赋值:IF(DDD,DDD日前的H,H)
DINGBUTS:=IF(DDD,DDD日前的GDTS,GDTS)
DINGBU1:=DDD+1日前的DINGBU
GDCS1赋值:CONST(DINGBUTS)
DINGBUTS1:=DDD+1日前的DINGBUTS
GDCS2赋值:CONST(DINGBUTS1)
DINGBU2:=DDD+1日前的DINGBU1
如果 到最后交易的周期>GDCS2返回0否则返回1
输出高点压力:DRAWLINE( 到最后交易的周期=GDCS2,H, 到最后交易的周期=GDCS1,H,1) 画绿色,DOTLINE
输出压力A:DRAWLINE( 到最后交易的周期=GDCS2,H,ISLASTBAR,GDCS2-1日前的H,1),COLOR0055FF,DOTLINE
输出压力B:DRAWLINE( 到最后交易的周期=GDCS1,H,ISLASTBAR,GDCS1-1日前的H,1),画黄色,DOTLINE
当满足条件1时,在横轴0.980纵轴20位置书写文字
AA1赋值:LOWN日前的L=2*LOWN+1日内L最低值
QY1:=BACKSET(AA1,LOWN+1)
CC1:=QY1的LOWN过滤 AND L=LOWN+1日内L最低值
DD1赋值:上次CC1距今天数
如果CC1返回 到最后交易的周期否则返回0
YDB赋值:IF(DD1,DD1日前的L,L)
DDTS1:=IF(DD1,DD1日前的DDTS,DDTS)
DDCS1赋值:CONST(DDTS1)
ZDB赋值:DD1+1日前的YDB
DDTS2:=DD1+1日前的DDTS1
DDCS2赋值:CONST(DDTS2)
输出低点支撑:DRAWLINE( 到最后交易的周期=DDCS2,L, 到最后交易的周期=DDCS1,L,1) 画红色,DOTLINE
ZGSTAR赋值:(高点压力+低点支撑)/2
ZGEND赋值:CONST((高点压力+低点支撑)/2)
如果DDCS2
输出中轨:DRAWLINE( 到最后交易的周期=STARDAY,ZGSTAR,ISLASTBAR,ZGEND,1),POINTDOT,COLORFFBBFF,LINETHICK1
TTT赋值:6
A1赋值:6日前的最高价=2*TTT+1日内最高价最高值
B1赋值:A1的TTT过滤
C1赋值:BACKSET(B1,TTT+1)
D1赋值:C1的TTT过滤
A2赋值:TTT日前的最低价=2*TTT+1日内最低价最低值
B2赋值:A2的TTT过滤
C2赋值:BACKSET(B2,TTT+1)
D2赋值:C2的TTT过滤
E1赋值:(REF(2*TTT日内最低价最低值,1)+REF(2*TTT日内最高价最高值,1))/2
E2赋值:(最高价+最低价)/2
H1赋值:(D1 AND NOT(D2 AND E1>=E2)) OR BARSTATUS OR 收盘价的有效数据周期数=1
L1赋值:(D2 AND NOT(D1 AND E1 H2赋值:D1 AND NOT(D2 AND E1>=E2)
X1赋值:REF(上次H1距今天数,1)+1
如果L1返回最低价否则返回10000
G1赋值:F1>1日前的F1
I1赋值:BACKSET(G1,2)
LD赋值:I1>1日前的I1
L2赋值:LD OR BARSTATUS OR 收盘价的有效数据周期数=1
X2赋值:REF(上次L2距今天数,1)+1
如果H2返回最高价否则返回0
G2赋值:F2>1日前的F2
I2赋值:BACKSET(G2,2)
HD赋值:I2>1日前的I2
UU赋值:BACKSET(BARSTATUS,上次LD距今天数+1)
VV赋值:UU>1日前的UU
WW赋值:BACKSET(VV,REF(上次LD距今天数,1)+2)
XX赋值:WW>1日前的WW
UU2:=BACKSET(BARSTATUS,上次HD距今天数+1)
VV2:=UU2>1日前的UU2
WW2:=BACKSET(VV2,REF(上次HD距今天数,1)+2)
XX2赋值:WW2>1日前的WW2
输出近低A:REF(L,上次VV距今天数),画白色,LINETHICK1,DOTLINE
输出近低B:REF(L,上次XX距今天数),画洋红色,DOTLINE
DRAWTEXT( 到最后交易的周期=2,高点压力,STRCAT('压力延伸:',CON2STR(高点压力,2))),画黄色
DRAWTEXT( 到最后交易的周期=2,低点支撑,STRCAT('支撑延伸:',CON2STR(低点支撑,2))),画黄色
DRAWTEXT( 到最后交易的周期=2,中轨,STRCAT('输出中轨:',CON2STR(中轨,2))),画黄色
DRAWTEXT( 到最后交易的周期=2,压力A,STRCAT('输出压力A:',CON2STR(压力A,2))),画黄色
DRAWTEXT( 到最后交易的周期=2,压力B,STRCAT('输出压力B:',CON2STR(压力B,2))),画黄色
DRAWTEXT( 到最后交易的周期=2,近低A,STRCAT('←输出近低A:',CON2STR(近低A,2))),画白色
DRAWTEXT( 到最后交易的周期=2,近低B,STRCAT('←输出近低B:',CON2STR(近低B,2))),画洋红色