通达信突破趋势线指标(源码主图贴图)

主图指标源码奉上~看看有没有高人能够做出选股公式出来~~

要求就是当日股价突破上方红色趋势线发出信号~~~

源码:

{连结MACD相邻红绿柱区间内高低点画趋势线 通达信}

DIFF:=EMA(CLOSE,12)-EMA(CLOSE,26);
 DEA:=EMA(DIFF,9);

N1:=BARSLAST(CROSS(DIFF,DEA))+1;{最近一次满足条件DIFF上穿DEA的K线到当前的距离}
N2:=BARSLAST(CROSS(DEA,DIFF))+1;{最近一次满足条件DIFF下穿DEA的K线到当前的距离}


 {当前是DIFF>DEA的状态,连结最近两个DIFF>DEA区间(不包含当前区间)内最高点的趋势线}
A1:=BACKSET(ISLASTBAR && N1<N2,REF(REF(HHVBARS(H,N1)+1,N2),N2)+REF(N2,N2)+N2);
 B1:=BACKSET(ISLASTBAR && N1<N2,REF(HHVBARS(H,N1),N2)+N2+1);
 DRAWLINE(CROSS(A1,0.5),H,CROSS(B1,0.5),H,1),COLORRED;

{当前是DIFF>DEA的状态,连结最近两个DIFF<DEA区间内最低点的趋势线}
A2:=BACKSET(ISLASTBAR && N1<N2,REF(REF(LLVBARS(L,N2)+1,N1),N2)+REF(N1,N2)+N2);
 B2:=BACKSET(ISLASTBAR && N1<N2,REF(LLVBARS(L,N2)+1,N1)+N1);
 DRAWLINE(CROSS(A2,0.5),L,CROSS(B2,0.5),L,1),COLORGREEN;

{当前是DIFF<DEA的状态,连结最近两个DIFF<DEA区间(不包含当前区间)内最低点的趋势线}
A3:=BACKSET(ISLASTBAR && N1>N2,REF(REF(LLVBARS(L,N2)+1,N1),N1)+REF(N1,N1)+N1);
 B3:=BACKSET(ISLASTBAR && N1>N2,REF(LLVBARS(L,N2),N1)+N1+1);
 DRAWLINE(CROSS(A3,0.5),L,CROSS(B3,0.5),L,1),COLORGREEN;

{当前是DIFF<DEA的状态,连结最近两个DIFF>DEA区间内最高点的趋势线}
A4:=BACKSET(ISLASTBAR && N1>N2,REF(REF(HHVBARS(H,N1)+1,N2),N1)+REF(N2,N1)+N1);
 B4:=BACKSET(ISLASTBAR && N1>N2,REF(HHVBARS(H,N1)+1,N2)+N2);
 DRAWLINE(CROSS(A4,0.5),H,CROSS(B4,0.5),H,1),COLORRED;
 

要求就是当日股价突破上方红色趋势线发出信号~~~

源码:

{连结MACD相邻红绿柱区间内高低点画趋势线 通达信}

DIFF:=EMA(CLOSE,12)-EMA(CLOSE,26);
 DEA:=EMA(DIFF,9);

N1:=BARSLAST(CROSS(DIFF,DEA))+1;{最近一次满足条件DIFF上穿DEA的K线到当前的距离}
N2:=BARSLAST(CROSS(DEA,DIFF))+1;{最近一次满足条件DIFF下穿DEA的K线到当前的距离}


 {当前是DIFF>DEA的状态,连结最近两个DIFF>DEA区间(不包含当前区间)内最高点的趋势线}
A1:=BACKSET(ISLASTBAR && N1<N2,REF(REF(HHVBARS(H,N1)+1,N2),N2)+REF(N2,N2)+N2);
 B1:=BACKSET(ISLASTBAR && N1<N2,REF(HHVBARS(H,N1),N2)+N2+1);
 DRAWLINE(CROSS(A1,0.5),H,CROSS(B1,0.5),H,1),COLORRED;

{当前是DIFF>DEA的状态,连结最近两个DIFF<DEA区间内最低点的趋势线}
A2:=BACKSET(ISLASTBAR && N1<N2,REF(REF(LLVBARS(L,N2)+1,N1),N2)+REF(N1,N2)+N2);
 B2:=BACKSET(ISLASTBAR && N1<N2,REF(LLVBARS(L,N2)+1,N1)+N1);
 DRAWLINE(CROSS(A2,0.5),L,CROSS(B2,0.5),L,1),COLORGREEN;

{当前是DIFF<DEA的状态,连结最近两个DIFF<DEA区间(不包含当前区间)内最低点的趋势线}
A3:=BACKSET(ISLASTBAR && N1>N2,REF(REF(LLVBARS(L,N2)+1,N1),N1)+REF(N1,N1)+N1);
 B3:=BACKSET(ISLASTBAR && N1>N2,REF(LLVBARS(L,N2),N1)+N1+1);
 DRAWLINE(CROSS(A3,0.5),L,CROSS(B3,0.5),L,1),COLORGREEN;

{当前是DIFF<DEA的状态,连结最近两个DIFF>DEA区间内最高点的趋势线}
A4:=BACKSET(ISLASTBAR && N1>N2,REF(REF(HHVBARS(H,N1)+1,N2),N1)+REF(N2,N1)+N1);
 B4:=BACKSET(ISLASTBAR && N1>N2,REF(HHVBARS(H,N1)+1,N2)+N2);
 DRAWLINE(CROSS(A4,0.5),H,CROSS(B4,0.5),H,1),COLORRED;




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

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

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