查看: 223|回复: 0

通达信【顶底趋势】主副图指标公式,波段拐点

[复制链接]

937

主题

90

回帖

2万

积分

管理员

积分
29314
发表于 2025-2-20 14:18:20 | 显示全部楼层 |阅读模式

大家好,我是仓鼠哥,专注于指标评测及量化研究,帮你囤满粮,我们一起度过所有的寒冬。
顶底趋势示图
c01f0dadc34ccc3323da31011775806e.png
顶底趋势主图源码:
AA1:=BARSLAST(REF(CROSS("MACD.DIF","MACD.DEA"),1));
DRAWTEXT(REF(C,AA1+1)>C AND REF("MACD.DIF",AA1+1)<"MACD.DIF" AND CROSS("MACD.DIF","MACD.DEA")>0,L-0.02,'★MACD底背离'),COLOR00FFFF;{MACD底背离}
AA2:=BARSLAST(REF(CROSS("KDJ.K","KDJ.D"),1));
DRAWTEXT(REF(C,AA2+1)>C AND REF("KDJ.K",AA2+1)<"KDJ.K" AND CROSS("KDJ.K","KDJ.D"),L-0.10,'◎KDJ底背离'),COLORFF00FF;{KDJ底背离}
AA3:=BARSLAST(REF(CROSS("RSI.RSI1","RSI.RSI2"),1));
DRAWTEXT(REF(C,AA3+1)>C AND REF("RSI.RSI1",AA3+1)<"RSI.RSI1" AND CROSS("RSI.RSI1","RSI.RSI2")>0,L-0.18,'◆RSI底背离'),COLOR0000FF;{RSI底背离};
CC1:=BARSLAST(REF(CROSS("MACD.DEA","MACD.DIF"),1));
DRAWTEXT(REF(C,CC1+1)<C AND REF("MACD.DIF",CC1+1)>"MACD.DIF" AND CROSS("MACD.DEA","MACD.DIF")>0,H+0.16,'★MACD顶背离'),COLOR00FF00;{MACD顶背离};
CC2:=BARSLAST(REF(CROSS("KDJ.D","KDJ.K"),1));
DRAWTEXT(REF(C,CC2+1)<C AND REF("KDJ.K",CC2+1)>"KDJ.K" AND CROSS("KDJ.D","KDJ.K")>0,H+0.08,'◎KDJ顶背离'),COLORFFFFCC;{BUYHAOGU.COM}
CC3:=BARSLAST(REF(CROSS("RSI.RSI2","RSI.RSI1"),1));
DRAWTEXT(REF(C,CC3+1)<C AND REF("RSI.RSI1",CC3+1)>"RSI.RSI1" AND CROSS("RSI.RSI2","RSI.RSI1")>0,H+0.04,'◆RSI顶背离'),COLORFF9900;{RSI顶背离};


AARAWTEXT(CROSS(ZIG(3,8),REF(ZIG(3,8),1)),LOW*0.99,'★拐点底') ,LINETHICK2,COLORYELLOW;
DRAWTEXT(CROSS(REF(ZIG(3,10),1),ZIG(3,10)),HIGH*1.01,'波段顶 '),LINETHICK2,COLOR00FF00;


A1:=REF(H,5)=HHV(H,2*5+1);
B1:=FILTER(A1,5);
C1:=BACKSET(B1,5+1);
D1:=FILTER(C1,5);
A2:=REF(L,5)=LLV(L,2*5+1);
B2:=FILTER(A2,5);
C2:=BACKSET(B2,5+1);
D2:=FILTER(C2,5);
E1:=(REF(LLV(L,2*5),1)+REF(HHV(H,2*5),1))/2;
E2:=(H+L)/2;
H1:=(D1&&NOT(D2&&E1>=E2))||ISLASTBAR||BARSCOUNT(C)=1;
L1:=(D2&&NOT(D1&&E1<E2));
H2:=D1&&NOT(D2&&E1>=E2);
X1:=REF(BARSLAST(H1),1)+1;
F1:=BACKSET(H1&&COUNT(L1,X1)>0,LLVBARS(IF(L1,L,10000),X1));
G1:=F1>REF(F1,1);
I1:=BACKSET(G1,2);
LD:=I1>REF(I1,1);
L2:=LD||ISLASTBAR||BARSCOUNT(C)=1;
X2:=REF(BARSLAST(L2),1)+1;
F2:=BACKSET(L2&&COUNT(H2,X2)>0,HHVBARS(IF(H2,H,0),X2));
G2:=F2>REF(F2,1);
I2:=BACKSET(G2,2);
HD:=I2>REF(I2,1);
R1:=BACKSET(ISLASTBAR,BARSLAST(HD)+1);
S1:=R1>REF(R1,1);
T1:=BACKSET(ISLASTBAR,BARSLAST(LD)+1);
U1:=T1>REF(T1,1);
R2:=BACKSET(S1,REF(BARSLAST(HD),1)+2);
S2:=R2>REF(R2,1);
T2:=BACKSET(U1,REF(BARSLAST(LD),1)+2);
U2:=T2>REF(T2,1);
T3:=BACKSET(U2,REF(BARSLAST(LD),1)+2);
U3:=T3>REF(T3,1);
T4:=BACKSET(U3,REF(BARSLAST(LD),1)+2);
U4:=T4>REF(T4,1);
R3:=BACKSET(S2,REF(BARSLAST(HD),1)+2);
S3:=R3>REF(R3,1);
R4:=BACKSET(S3,REF(BARSLAST(HD),1)+2);
S4:=R4>REF(R4,1);DRAWLINE(S2,H,S1,H,1),COLORRED,LINETHICK3;
DRAWLINE(U2,L,U1,L,1),COLORWHITE,LINETHICK3;
DRAWLINE(S3,H,S2,H,1),COLORMAGENTA,LINETHICK3;
DRAWLINE(U3,L,U2,L,1),COLORYELLOW,LINETHICK3;
DRAWLINE(S4,H,S3,H,1),COLORBLUE,LINETHICK3;
DRAWLINE(U4,L,U3,L,1),COLORGREEN,LINETHICK3;
顶底趋势副图源码:
200,COLORLIGREEN;
100,COLORLIBLUE;
0,COLORWHITE;
-100,COLORLIRED;
-200,COLORMAGENTA;
TYP:=(HIGH+LOW+CLOSE)/3;
CCI:=(TYP-MA(TYP,14))/(0.015*AVEDEV(TYP,14)),STICK;
趋势线:EXPMA(CCI,4.5),COLORFF8000,NODRAW;
DRAWBAND(CCI,RGB(128,0,0),趋势线,RGB(0,128,0));
STICKLINE(CCI>=0,0,CCI,0,-1),COLORLIRED;
STICKLINE(CCI< 0,0,CCI,0,-1),COLORLIBLUE;
CCI值TYP-MA(TYP,14))/(0.015*AVEDEV(TYP,14)),COLORYELLOW,LINETHICK1;
DRAWICON(CROSS(CCI值,150),180,15);
N:=5;
CCI底背:=REF(C,BARSLAST(REF(FILTER(BACKSET(REF(CCI,N)=LLV(CCI,2*N+1),N+1),N) AND CCI=LLV(CCI,N+1),1))+1)>C AND REF(CCI,BARSLAST(REF(FILTER(BACKSET(REF(CCI,N)=LLV(CCI,2*N+1),N+1),N) AND CCI=LLV(CCI,N+1),1))+1)< CCI AND FILTER(BACKSET(REF(CCI,N)=LLV(CCI,2*N+1),N+1),N) AND CCI=LLV(CCI,N+1),COLORWHITE,NODRAW;
DRAWLINE(FILTER(BACKSET(REF(CCI,N)=LLV(CCI,2*N+1),N+1),N) AND CCI=LLV(CCI,N+1),CCI,FILTER(CCI底背>0,5),CCI,0), COLORWHITE,DOTLINE;
DRAWTEXT(CCI底背,CCI,'底背'),COLORWHITE;
CCI顶背:=REF(C,BARSLAST(REF(FILTER(BACKSET(REF(CCI,N)=HHV(CCI,2*N+1),N+1),N) AND CCI=HHV(CCI,N+1),1))+1)< C AND REF(CCI,BARSLAST(REF(FILTER(BACKSET(REF(CCI,N)=HHV(CCI,2*N+1),N+1),N) AND CCI=HHV(CCI,N+1),1))+1)>CCI AND FILTER(BACKSET(REF(CCI,N)=HHV(CCI,2*N+1),N+1),N) AND CCI=HHV(CCI,N+1),COLORGREEN,NODRAW;
DRAWLINE(FILTER(BACKSET(REF(CCI,N)=HHV(CCI,2*N+1),N+1),N) AND CCI=HHV(CCI,N+1),CCI,FILTER(CCI顶背>0,5),CCI,0), COLORLIGRAY,DOTLINE;
DRAWTEXT(CCI顶背,CCI,'顶背'),COLORLIGRAY;
趋势线底背:=REF(C,BARSLAST(REF(FILTER(BACKSET(REF(趋势线,N)=LLV(趋势线,2*N+1),N+1),N) AND 趋势线=LLV(趋势线,N+1),1))+1)>C AND REF(趋势线,BARSLAST(REF(FILTER(BACKSET(REF(趋势线,N)=LLV(趋势线,2*N+1),N+1),N) AND 趋势线=LLV(趋势线,N+1),1))+1)< 趋势线 AND FILTER(BACKSET(REF(趋势线,N)=LLV(趋势线,2*N+1),N+1),N) AND 趋势线=LLV(趋势线,N+1),COLORWHITE,NODRAW;
DRAWLINE(FILTER(BACKSET(REF(趋势线,N)=LLV(趋势线,2*N+1),N+1),N) AND 趋势线=LLV(趋势线,N+1),趋势线,FILTER(趋势线底背>0,5),趋势线,0), COLORWHITE,DOTLINE;
DRAWTEXT(趋势线底背,趋势线,'底背'),COLORFF80FF;
趋势线顶背:=REF(C,BARSLAST(REF(FILTER(BACKSET(REF(趋势线,N)=HHV(趋势线,2*N+1),N+1),N) AND 趋势线=HHV(趋势线,N+1),1))+1)< C AND REF(趋势线,BARSLAST(REF(FILTER(BACKSET(REF(趋势线,N)=HHV(趋势线,2*N+1),N+1),N) AND 趋势线=HHV(趋势线,N+1),1))+1)>趋势线 AND FILTER(BACKSET(REF(趋势线,N)=HHV(趋势线,2*N+1),N+1),N) AND 趋势线=HHV(趋势线,N+1),COLORGREEN,NODRAW;
DRAWLINE(FILTER(BACKSET(REF(趋势线,N)=HHV(趋势线,2*N+1),N+1),N) AND 趋势线=HHV(趋势线,N+1),趋势线,FILTER(趋势线顶背>0,5),趋势线,0), COLORGREEN,DOTLINE;
DRAWTEXT(趋势线顶背,趋势线,'顶背'),COLORLIGREEN;
N1:=20;
JJ:=(((CLOSE - LLV(LOW,N1)) / (HHV(HIGH,N1) - LLV(LOW,N1))) * 100);
M5F:=MA(C,4);
M10F:=MA(C,8),COLORRED,LINETHICK2;
M20F:=MA(C,20);
M60F:=MA(C,60),COLORBLUE,LINETHICK2;
D3:=MIN(MIN(M5F,M10F),M20F)>M60F;
LLM:=LLV("MACD.MACD"*100,200);
HHM:=HHV("MACD.MACD"*100,200);
TJA:=C>REF(C,1)*1.05;
T:=BARSLAST(C>REF(C,1)*1.095 AND C=H);
T2L:=BARSLAST(C< REF(C,1)*1.095 AND C>REF(C,1)*1.08);
T3L:=BARSLAST(C< REF(C,1)*1.08 AND C>REF(C,1)*1.07);
T4L:=BARSLAST(C< REF(C,1)*1.07 AND C>REF(C,1)*1.06);
T5L:=BARSLAST(C< REF(C,1)*1.06 AND C>REF(C,1)*1.05);
AAF1:=REF(T,1)>100 AND REF(T2L,1)>100 AND REF(T3L,1)>100 AND REF(T4L,1)>100 AND REF(T5L,1)>80 AND TJA;
XGT:=BARSLAST(AAF1 AND HHM< 60 AND LLM>-55);
D6:=BARSSINCEN(MIN(MIN(M5F,M10F),M20F)>M60F,XGT+1);
XGX:=CROSS((XGT=0 AND D3) OR D6=0,0.5);
TJJ:=COUNT(XGX,30)=2 AND XGX;
SR1:=REF(HIGH,10)=HHV(HIGH,2*10+1);
SR2:=FILTER(SR1,10);
SR3:=REF(SR2,10+1);
HDF:=REF(SR3,10);
前高:=REF(H,BARSLAST(HDF));
倍量:=VOL/REF(VOL,1)>=1.9;
突破前高:=CROSS(C,前高);
YG:= 倍量 AND 突破前高;
低2:=IF(CURRBARSCOUNT<=60, CONST(IF(ISLASTBAR=1,LLV(L, BARSLAST(CURRBARSCOUNT=60)),1)),DRAWNULL);
SJ:=BARSLAST(YG);
DIF:=MACD.DIF;
H300:=HHVBARS(DIF,300);
AL:=BOLL.UB;
TQ:=BARSLAST(CROSS(AL>=REF(AL,1),0.5));
E25:=EXPMA(C,25);
ZF:=EVERY(RANGE(C/REF(C,1),0.97,1.05),TQ+1);
ZFF:=(HHV(H,TQ+1)-LLV(L,TQ+1))/LLV(L,TQ+1)*100;
TJQ:=EVERY(MAX(C,O)/AL< 1.02 ,TQ+1);
XL:=(ATAN((E25/REF(E25,TQ)-1)*100)*180/3.1415926);
TJ1Q:=CROSS(DIF>=REF(DIF,H300),0.5) AND ZFF< 17 AND ZF AND TJQ;
躁动:=TJ1Q AND XL>75;
A1F:=REF(C,1);
AYFF:=REF(C,10);
A31F:=(AYFF-A1F)/A1F*100;
AA1F:=(A31F-REF(A31F,1));
选股1:=CROSS(AAF1,9.8);
A11F:=REF(V,1);
VAR81:=IF(VOL/CAPITAL>0.001,1,EXP(ABS(LOG(VOL/CAPITAL*100))))>2;
A13F:=VAR81/A11F;
AA3F:=(A13F-REF(A13F,1));
选股2:=CROSS(AA3F,500);
潜伏2:=选股1 AND 选股2;
GX:=潜伏2 OR 躁动 OR CURRBARSCOUNT=CONST(SJ)+2 OR TJJ OR (CCI<=100 AND L<=低2);
准备:=FILTER(GX=1,3);
A2A:=BARSCOUNT(C);
AH:=HHV(H,200);
A1L:=LLV(L,200);
A0:=(AH-A1L)/190;
B1F:=L-A0;
STICKLINE(准备,-150,-200,1,0),COLOR00CCFF;
DRAWTEXT(准备,-100,'启动'),COLORYELLOW;



温馨提示:以上内容为互联网获取公开信息,并非任何推荐,观点仅供参考,个人投资行为,与本号无关。股市有风险,投资需谨慎。


顶底趋势.tn6

18.53 KB, 下载次数: 84

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

指标评测

股指标

建议反馈

常见问题

股指标评测

商务合作

新闻媒体

量化投资研究社

联系我们

微信:ZBPC88

备用微信:cqcangshu

邮箱:1099750285@qq.com

关注微信公众号

QQ|手机版|小黑屋|股指标网 ( 渝ICP备2024026571号-1 )股指标

GMT+8, 2025-4-7 05:37 , Processed in 0.146652 second(s), 30 queries .

Powered by Discuz! X3.5

© 2001-2025 Discuz! Team.