ihzx 发表于 2021-8-28 00:20:14

通达信一阳定势+强势突破 自动画线 可修改源码做预警公式


         <p>以下是通达信一阳定势+强势突破 自动画线 可修改源码做预警公式(无源码的请下载附件导入)</p>
<div class="con" id="rjsmad1"></div>
<p>可修改指标源码做成预警公式。因为用到自动划线所以指标有未来函数,但是信号不会漂移,可用沙盘试验,信号出来后就是连续跌停信号也不会消失,因为划线是取近期一段交易日的数据,之前符合条件的信号不会再显示,使用沙盘倒推功能能看到历史符合条件的信号<br>
&nbsp;</p>
<p>笔周期:=3;<br>
画趋势:=0;<br>
A1:=REF(HIGH,3)=HHV(HIGH,笔周期*3+1);<br>
B1:=FILTER(A1,3);<br>
C1:=BACKSET(B1,3+1);<br>
D1:=FILTER(C1,3);{高点}<br>
A2:=REF(LOW,3)=LLV(LOW,笔周期*3+1);<br>
B2:=FILTER(A2,3);<br>
C2:=BACKSET(B2,3+1);<br>
D2:=FILTER(C2,3);{低点}<br>
E1:=(REF(LLV(LOW,2*3),1)+REF(HHV(HIGH,2*3),1))/2;<br>
E2:=(HIGH+LOW)/2;{高低点出现在同一K线上时可作取舍}<br>
H1:=(D1 AND NOT(D2 AND E1&gt;=E2)) OR BARSTATUS=2 OR BARSCOUNT(CLOSE)=1;<br>
H2:=D1 AND NOT(D2 AND E1&gt;=E2);<br>
L1:=D2 AND NOT(D1 AND E1=E2);<br>
X1:=REF(BARSLAST(H1),1)+1;<br>
F1:=BACKSET(H1 AND COUNT(L1,X1)&gt;0,LLVBARS(IF(L1,LOW,10000),X1));<br>
G1:=F1&gt;REF(F1,1);<br>
I1:=BACKSET(G1,2);<br>
LD:=I1&gt;REF(I1,1);{过滤后低点}<br>
L2:=LD OR BARSTATUS=2 OR BARSCOUNT(CLOSE)=1;<br>
X2:=REF(BARSLAST(L2),1)+1;<br>
F2:=BACKSET(L2 AND COUNT(H2,X2)&gt;0,HHVBARS(IF(H2,HIGH,0),X2));<br>
G2:=F2&gt;REF(F2,1);<br>
I2:=BACKSET(G2,2);<br>
HD:=I2&gt;REF(I2,1);{过滤后高点}<br>
DRAWLINE(LD,L,HD,H,0),COLORYELLOW,LINETHICK1;<br>
DRAWLINE(HD,H,LD,L,0),COLORYELLOW,LINETHICK1;<br>
J1:=BACKSET(BARSTATUS=2,MIN(BARSLAST(HD),BARSLAST(LD))+1);<br>
J2:=J1&gt;REF(J1,1);<br>
A3:=H;<br>
B3:=REF(H,REF(BARSLAST(HD),1)+1)&gt;REF(H,REF(BARSLAST(HD),1)+2+REF(BARSLAST(HD),REF(BARSLAST(HD),1)+2));DRAWTEXT_FIX(1,0.980,20,1,'★分析家公式网'),COLOR666666;<br>
D3:=A3 AND B3 AND HD;<br>
E3:=BACKSET(D3,REF(BARSLAST(HD),1)+2);<br>
HH:=E3&gt;REF(E3,1);{找出全部长期高点}<br>
A4:=L&gt;REF(L,REF(BARSLAST(LD),1)+1);<br>
B4:=REF(L,REF(BARSLAST(LD),1)+1);<br>
D4:=A4 AND B4 AND LD;<br>
E4:=BACKSET(D4,REF(BARSLAST(LD),1)+2);<br>
LL:=E4&gt;REF(E4,1);{找出全部长期低点} <br>
H3:=HH OR BARSTATUS=2 OR BARSCOUNT(C)=1; {后面进行过滤,方法同前。只是不用考虑高低点出现在同一K线}<br>
X3:=REF(BARSLAST(H3),1)+1;<br>
F3:=BACKSET(H3 AND COUNT(LL,X3)&gt;0,LLVBARS(IF(LL,L,POW(10,20)),X3));<br>
G3:=F3&gt;REF(F3,1); I3:=BACKSET(G3,2);<br>
LZ:=I3&gt;REF(I3,1); {长期低点,也可供引用}<br>
L4:=LZ OR BARSTATUS=2 OR BARSCOUNT(C)=1;<br>
X4:=REF(BARSLAST(L4),1)+1;<br>
F4:=BACKSET(L4 AND COUNT(HH,X4)&gt;0,HHVBARS(IF(HH,H,-POW(10,20)),X4));<br>
G4:=F4&gt;REF(F4,1); I4:=BACKSET(G4,2); HZ:=I4&gt;REF(I4,1);{长期高点,也可供引用}<br>
K1:=BACKSET(BARSTATUS=2,MIN(BARSLAST(HZ),BARSLAST(LZ))+1); K2:=K1&gt;REF(K1,1);<br>
UU:=BACKSET(BARSTATUS=2,BARSLAST(LD)+1);<br>
VV:=UU&gt;REF(UU,1);<br>
WW:=BACKSET(VV,REF(BARSLAST(LD),1)+2);<br>
XX:=WW&gt;REF(WW,1);<br>
WWQ:=BACKSET(XX,REF(BARSLAST(LD),1)+2);<br>
XXQ:=WWQ&gt;REF(WWQ,1);<br>
下轨:=DRAWLINE(XX,L,VV,L,1),COLORMAGENTA,LINETHICK2;{画趋势线}<br>
UU2:=BACKSET(BARSTATUS=2,BARSLAST(HD)+1);<br>
VV2:=UU2&gt;REF(UU2,1);<br>
WW2:=BACKSET(VV2,REF(BARSLAST(HD),1)+2);<br>
XX2:=WW2&gt;REF(WW2,1);<br>
WW3Q:=BACKSET(XX2,REF(BARSLAST(HD),1)+2);<br>
XX3Q:=WW3Q&gt;REF(WW3Q,1);<br>
WW4Q:=BACKSET(XX3Q,REF(BARSLAST(HD),1)+2);<br>
XX4Q:=WW4Q&gt;REF(WW4Q,1);<br>
上轨:=DRAWLINE(XX2,H,VV2,H,1),COLORMAGENTA,LINETHICK2;{画趋势线};<br>
上轨1:=DRAWLINE(XX2,H,VV2,H,1);<br>
Q0:=BARSLAST(XX2&gt;0);<br>
Q1:=BARSLAST(XX&gt;0);<br>
Q2:=BARSLAST(WW2&gt;0);<br>
Q3:=BARSLAST(VV&gt;0);<br>
Q4:=BARSLAST(XXQ&gt;0);<br>
Q5:=BARSLAST(XX3Q&gt;0);<br>
Q6:=BARSLAST(XX4Q&gt;0);<br>
近期低:REF(L,BARSLAST(VV)),DOTLINE,COLOR99FF66;<br>
近期高:REF(H,BARSLAST(VV2)),DOTLINE,COLOR99FF66;<br>
上次低:REF(L,BARSLAST(XX)),DOTLINE,COLORFF66FF;<br>
上次高:REF(H,BARSLAST(XX2)),DOTLINE,COLORFF66FF;<br>
ABC:=IF(Q5&gt;Q4,REF(L,BARSLAST(XXQ)),0),DOTLINE,COLORCYAN;<br>
①②③:=IF(Q5&lt;Q4,REF(H,BARSLAST(XX3Q)),0),DOTLINE,COLORCYAN;<br>
笔:DRAWLINE(J2,IF(HD,H,L),BARSTATUS=2,IF(BARSLAST(HD)&gt;BARSLAST(LD),H,L),0),DOTLINE,COLORYELLOW,LINETHICK1;<br>
DRAWTEXT( VV=1 AND Q0&gt;Q1,L,'C')COLORMAGENTA;<br>
DRAWTEXT(VV2=1 AND Q0&gt;Q1,H,'B')COLORMAGENTA;<br>
DRAWTEXT( XX=1 AND Q0&gt;Q1,L,'A')COLORMAGENTA;<br>
DRAWTEXT(XX2=1 AND Q5&gt;Q4 ,H,'◆2')COLORMAGENTA;<br>
DRAWTEXT(XXQ=1 AND Q5&gt;Q4 ,L,'◆1')COLORMAGENTA;<br>
DRAWTEXT( VV=1 AND Q0&lt;Q1,L,'B-')COLORMAGENTA;<br>
DRAWTEXT(VV2=1 AND Q0&lt;Q1,H,'C-')COLORMAGENTA;<br>
DRAWTEXT(XX2=1 AND Q0&lt;Q1,H,'A-')COLORMAGENTA;<br>
DRAWTEXT(XX=1 AND Q5&lt;Q4,L,'◆2')COLORMAGENTA;<br>
DRAWTEXT(XX3Q=1 AND Q5&lt;Q4,H,'◆1')COLORMAGENTA;<br>
V00:=HIGH&lt;REF(HIGH,1) AND LOW&lt;REF(LOW,1);<br>
V01:=HIGH&lt;REF(HIGH,1) AND LOW&gt;REF(LOW,1);<br>
V02:=HIGH&gt;REF(HIGH,1) AND LOW&lt;REF(LOW,1);<br>
V03:=HIGH&gt;REF(HIGH,1) AND LOW&gt;REF(LOW,1);<br>
V04:=REF(HIGH,2)&lt;HIGH AND REF(LOW,2)&lt;LOW AND REF(HIGH,2)&gt;REF(HIGH,1) AND REF(LOW,2) &lt; REF(LOW,1);<br>
V1:=COUNT(V00,3)&gt;=1 AND LLVBARS(LOW,3)=1 AND V03;<br>
V2:=COUNT(V00,4)&gt;=1 AND LLVBARS(LOW,4)=2 AND V04;<br>
V3:=COUNT(V00,4)&gt;=1 AND COUNT(V01 OR V02,4)=1 AND LLVBARS(LOW,4)=1 AND V03;<br>
V4:=COUNT(V00,5)&gt;=1 AND COUNT(V01 OR V02,5)=2 AND LLVBARS(LOW,5)=2 AND V04;<br>
XG1:=V1 OR V2 OR V3 OR V4;<br>
XG2:=C&gt;REF(HIGH,1);<br>
XG:=XG1 AND XG2;<br>
{收敛突破:=上次低&lt;近期低 AND 上次高&gt;近期高 AND CROSS(C,上轨) AND C&gt;O;<br>
DRAWTEXT(收敛突破=1,L,'收敛突破'),COLORYELLOW;}<br>
突破:=CROSS(C,近期高) AND C&gt;O;<br>
STICKLINE(突破,OPEN,CLOSE,2.8,0),COLORMAGENTA;<br>
强势突破:=上次低&lt;近期低 AND 上次高&lt;近期高 AND CROSS(C,近期高) AND C&gt;O;<br>
STICKLINE(强势突破,OPEN,CLOSE,2.8,0),COLORMAGENTA;<br>
DRAWTEXT(强势突破=1,H,'强势突破'),COLORYELLOW;<br>
{反弹突破:=CROSS(C,上次低) AND C&gt;O;<br>
STICKLINE(反弹突破,OPEN,CLOSE,2.8,1),COLORMAGENTA;<br>
STICKLINE(反弹突破,OPEN,CLOSE,1,1),COLORWHITE;<br>
DRAWTEXT(反弹突破=1,L,'反弹突破'),COLORYELLOW;}<br>
DRAWTEXT(突破=1,L,' 突破'),COLORYELLOW;<br>
一阳定势:=CROSS(C,近期高) AND CROSS(C,上次高) AND C&gt;O;<br>
STICKLINE(一阳定势,OPEN,CLOSE,2.8,0),COLORMAGENTA;<br>
DRAWTEXT(一阳定势=1,(OPEN+CLOSE)/2,' 一阳定势'),COLORRED;</p>
<p>STICKLINE(一阳定势,OPEN,CLOSE,1,0),COLORYELLOW;<br>
STICKLINE(强势突破,OPEN,CLOSE,1,0),COLORYELLOW;</p>
<p></p>
<p></p>
页: [1]
查看完整版本: 通达信一阳定势+强势突破 自动画线 可修改源码做预警公式