macd顶底背离dif线背离共振副图金叉选股 股票指标炒股软件公式
26
2024 / 11 / 20
2022-11-24 09:14:02 通达信指标网
半分位:=50;
MA1:MA(CLOSE,M1),COLORGRAY;
MA2:MA(CLOSE,M2),COLORMAGENTA,LINETHICK2;
MA3:MA(CLOSE,M3),COLOR408000;
MA4:MA(CLOSE,M4),COLORLIBLUE;
HYDB2:DRAWKLINE(H,O,L,C);
日线:=IF(PERIOD=5,1,0);
CA3:=REF(C,1)*日线;
涨停:=IF((C-CA3)*100/CA3>=(10-0.01*100/CA3),1,0);
STICKLINE(涨停,OPEN,CLOSE,2.9.1,1),COLORFF00FF;
跌停:=IF((CA3-C)*100/CA3>=(10-0.01*100/CA3),1,0);
STICKLINE(跌停,OPEN,CLOSE,2.9.1,0),COLOR808000;
A1:=TDXDLL2(8,20,HIGH,3)=TDXDLL2(2,笔周期*3+1,HIGH,L);
B1:=FILTER(A1,3); C1:=BACKSET(B1,3+1);
D1:=FILTER(C1,3);{高点}
A2:=TDXDLL2(8,20,LOW,3)=TDXDLL2(3,笔周期*3+1,LOW,H);
B2:=FILTER(A2,3); C2:=BACKSET(B2,3+1);
D2:=FILTER(C2,3);{低点}
E1:=(REF(LLV(LOW,2*3),1)+REF(HHV(HIGH,2*3),1))/2;
E2:=(HIGH+LOW)/2;{高低点出现在同一K线上时可作取舍}
H1:=(D1 AND NOT(D2 AND E1>=E2)) OR BARSTATUS=2 OR BARSCOUNT(CLOSE)=1;
H2:=D1 AND NOT(D2 AND E1>=E2);
L1:=D2 AND NOT(D1 AND E1=E2);
X1:=TDXDLL2(8,20,BARSLAST(H1),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=2 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);{过滤后高点}
DRAWLINE(LD,L,HD,H,0),COLORRED,LINETHICK2;
DRAWLINE(HD,H,LD,L,0),COLOR408000,LINETHICK2;
J1:=BACKSET(BARSTATUS=2,MIN(BARSLAST(HD),BARSLAST(LD))+1);
J2:=J1>REF(J1,1);
A3:=H;
B3:=REF(H,REF(BARSLAST(HD),1)+1)>REF(H,REF(BARSLAST(HD),1)+2+REF(BARSLAST(HD),REF(BARSLAST(HD),1)+2));
D3:=A3 AND B3 AND HD;
E3:=BACKSET(D3,REF(BARSLAST(HD),1)+2);
HH:=E3>REF(E3,1);{找出全部长期高点}
A4:=L>REF(L,REF(BARSLAST(LD),1)+1);
B4:=REF(L,REF(BARSLAST(LD),1)+1);
D4:=A4 AND B4 AND LD;
E4:=BACKSET(D4,REF(BARSLAST(LD),1)+2);
LL:=E4>REF(E4,1);{找出全部长期低点}
H3:=HH OR BARSTATUS=2 OR BARSCOUNT(C)=1; {后面进行过滤,方法同前。只是不用考虑高低点出现在同一K线}
X3:=REF(BARSLAST(H3),1)+1;
F3:=BACKSET(H3 AND COUNT(LL,X3)>0,LLVBARS(IF(LL,L,POW(10,20)),X3));
G3:=F3>REF(F3,1); I3:=BACKSET(G3,2);
LZ:=I3>REF(I3,1); {长期低点,也可供引用}
L4:=LZ OR BARSTATUS=2 OR BARSCOUNT(C)=1;
X4:=REF(BARSLAST(L4),1)+1;
F4:=BACKSET(L4 AND COUNT(HH,X4)>0,HHVBARS(IF(HH,H,-POW(10,20)),X4));
G4:=F4>REF(F4,1); I4:=BACKSET(G4,2); HZ:=I4>REF(I4,1);{长期高点,也可供引用}
{DRAWLINE(HZ,H,LZ,L,0),COLORGREEN,LINETHICK1;
DRAWLINE(LZ,L,HZ,H,0),COLORGREEN,LINETHICK1;长期连线}
K1:=BACKSET(BARSTATUS=2,MIN(BARSLAST(HZ),BARSLAST(LZ))+1); K2:=K1>REF(K1,1);
{DRAWLINE(K2,IF(HZ,H,L),BARSTATUS=2,C,0),COLORGREEN,LINETHICK1; 最后的长期连线,连在收盘价上}
UU:=BACKSET(BARSTATUS=2,BARSLAST(LD)+1);
VV:=UU>REF(UU,1);
WW:=BACKSET(VV,TDXDLL2(8,20,BARSLAST(LD),1)+2);
XX:=WW>REF(WW,1);
WWQ:=BACKSET(XX,TDXDLL2(8,20,BARSLAST(LD),1)+2);
XXQ:=WWQ>REF(WWQ,1);
下轨:DRAWLINE(XX,L,VV,L,1)*画趋势,COLORMAGENTA,LINETHICK1;{画趋势线}
UU2:=BACKSET(BARSTATUS=2,BARSLAST(HD)+1);
VV2:=UU2>REF(UU2,1);
WW2:=BACKSET(VV2,TDXDLL2(8,20,BARSLAST(HD),1)+2);
XX2:=WW2>REF(WW2,1);
WW3Q:=BACKSET(XX2,TDXDLL2(8,20,BARSLAST(HD),1)+2);
XX3Q:=WW3Q>REF(WW3Q,1);
WW4Q:=BACKSET(XX3Q,TDXDLL2(8,20,BARSLAST(HD),1)+2);
XX4Q:=WW4Q>REF(WW4Q,1);
上轨:DRAWLINE(XX2,H,VV2,H,1)*画趋势,COLORMAGENTA,LINETHICK1;{画趋势线}
上轨1:=DRAWLINE(XX2,H,VV2,H,1);
Q0:=BARSLAST(XX2>0);
Q1:=BARSLAST(XX>0);
Q2:=BARSLAST(WW2>0);
Q3:=BARSLAST(VV>0);
Q4:=BARSLAST(XXQ>0);
Q5:=BARSLAST(XX3Q>0);
Q6:=BARSLAST(XX4Q>0);
OA周:=Q0-Q1+1;AB周:=Q1-Q2+1;BC周:=Q2-Q3+1;
DRAWTEXT_FIX(CURRBARSCOUNT=1 AND(Q5)>Q4,0.10,0.01,1,STRCAT('◆A: ',STRCAT(CON2STR(OA周,0),'周')))COLOR408000;
DRAWTEXT_FIX(CURRBARSCOUNT=1 AND(Q5)>Q4,0.10,0.08,1,STRCAT(' A―B: ',STRCAT(CON2STR(AB周,0),'周')))COLORRED;
DRAWTEXT_FIX(CURRBARSCOUNT=1 AND(Q5)>Q4,0.10,0.16,1,STRCAT(' B―C: ',STRCAT(CON2STR(BC周,0),'周')))COLOR408000;
DRAWTEXT_FIX(CURRBARSCOUNT=1 AND(Q5)>Q4,0.10,0.24,1,STRCAT('C---: ',STRCAT(CON2STR(Q3,0),'周')))COLOR4080FF;
{123周期}
Z01:=Q1-Q0+1;Z12:=Q0-Q3+1;Z23:=Q3-Q2+1;
DRAWTEXT_FIX(CURRBARSCOUNT=1 AND(Q5)<Q4,0.10,0.01,1,STRCAT('◎―1: ',STRCAT(CON2STR(Z01,0),'周')))COLORRED;
DRAWTEXT_FIX(CURRBARSCOUNT=1 AND(Q5)<Q4,0.10,0.08,1,STRCAT('1―2: ',STRCAT(CON2STR(Z12,0),'周')))COLOR408000;
DRAWTEXT_FIX(CURRBARSCOUNT=1 AND(Q5)<Q4,0.10,0.16,1,STRCAT('2―3: ',STRCAT(CON2STR(Z23,0),'周')))COLORRED;
DRAWTEXT_FIX(CURRBARSCOUNT=1 AND(Q5)<Q4,0.10,0.24,1,STRCAT('3--- : ',STRCAT(CON2STR(Q2,0),'周')))COLOR4080FF;
低一:REF(L,BARSLAST(VV)),DOTLINE,COLOR408000;
高一:REF(H,BARSLAST(VV2)),DOTLINE,COLOR408000;
低二:=REF(L,BARSLAST(XX)),DOTLINE,COLORFF66FF;
高二:=REF(H,BARSLAST(XX2)),DOTLINE,COLORFF66FF;
ABC:=IF(Q5>Q4,REF(L,BARSLAST(XXQ)),0),DOTLINE,COLORLIBLUE;
①②③:=IF(Q5<Q4,REF(H,BARSLAST(XX3Q)),0),DOTLINE,COLORLIBLUE;
{ABC涨跌}
OA幅:=(低二-高二)/低二*100;AB幅:=(高一-低二)/低二*100;BC幅:=(低一-高一)/高一*100;AO幅:=(C-低一)/C*100;
DRAWTEXT_FIX(CURRBARSCOUNT=1 AND(Q5)>Q4,0.14,0.01,0,STRCAT('跌',STRCAT(CON2STR(OA幅,0),'%')))COLOR408000;
DRAWTEXT_FIX(CURRBARSCOUNT=1 AND(Q5)>Q4,0.14,0.08,0,STRCAT('涨',STRCAT(CON2STR(AB幅,0),'%')))COLORRED;
DRAWTEXT_FIX(CURRBARSCOUNT=1 AND(Q5)>Q4,0.14,0.16,0,STRCAT('跌',STRCAT(CON2STR(BC幅,0),'%')))COLOR408000;
DRAWTEXT_FIX(CURRBARSCOUNT=1 AND(Q5)>Q4,0.14,0.24,0,STRCAT('涨',STRCAT(CON2STR(AO幅,0),'%')))COLOR4080FF;
{123涨跌}
D01:=(高二-低二)/低二*100;D12:=(低一-高二)/低一*100;D23:=(高一-低一)/低一*100;D30:=(C-高一)/C*100;
DRAWTEXT_FIX(CURRBARSCOUNT=1 AND(Q5)<Q4,0.14,0.01,0,STRCAT('涨',STRCAT(CON2STR(D01,0),'%')))COLORRED;
DRAWTEXT_FIX(CURRBARSCOUNT=1 AND(Q5)<Q4,0.14,0.08,0,STRCAT('跌',STRCAT(CON2STR(D12,0),'%')))COLOR408000;
DRAWTEXT_FIX(CURRBARSCOUNT=1 AND(Q5)<Q4,0.14,0.16,0,STRCAT('涨',STRCAT(CON2STR(D23,0),'%')))COLORRED;
DRAWTEXT_FIX(CURRBARSCOUNT=1 AND(Q5)<Q4,0.14,0.24,0,STRCAT('跌',STRCAT(CON2STR(D30,0),'%')))COLOR4080FF;
笔:DRAWLINE(J2,IF(HD,H,L),BARSTATUS=2,IF(BARSLAST(HD)>BARSLAST(LD),H,L),0),DOTLINE,COLOR4080FF,LINETHICK1;
{近半分位:高一-(高一-低一)*(0.01*半分位),COLOR99FF66;}
近半分位:=低一-(低一-高一)*(0.01*半分位),COLOR4080FF;
DRAWTEXT( VV=1 AND Q0>Q1,L,'C')COLORMAGENTA;
DRAWTEXT(VV2=1 AND Q0>Q1,H,'B')COLORMAGENTA;
DRAWTEXT( XX=1 AND Q0>Q1,L,'A')COLORMAGENTA;
DRAWTEXT(XX2=1 AND Q5>Q4 ,H,'◆')COLORMAGENTA;
DRAWTEXT(XXQ=1 AND Q5>Q4 ,L,'★')COLORMAGENTA;
DRAWTEXT( VV=1 AND Q0<Q1,L,'②')COLORMAGENTA;
DRAWTEXT(VV2=1 AND Q0<Q1,H,'③')COLORMAGENTA;
DRAWTEXT(XX2=1 AND Q0<Q1,H,'①')COLORMAGENTA;
DRAWTEXT(XX=1 AND Q5<Q4,L,'◎')COLORMAGENTA;
DRAWTEXT(XX3Q=1 AND Q5<Q4,H,'☆')COLORMAGENTA;
低点:=VV=1;
高点:=VV2=1;
上下类型:CONST(BARSLAST(高点)>BARSLAST(低点)),NODRAW;
点A位:=XX=1;
点1位:=XX2=1;
上左差:=REF(HIGH,BARSLAST(高点))-REF(LOW,BARSLAST(点A位)),NODRAW;
上底线:IF(上下类型=1 AND 低一>=低二 ,REF(LOW,BARSLAST(低点))+上左差*0,DRAWNULL),COLOR4080FF;
上382:IF(上下类型=1 AND 低一>=低二 ,REF(LOW,BARSLAST(低点))+上左差*0.382,DRAWNULL),DOTLINE,COLOR4080FF;
上618:IF(上下类型=1 AND 低一>=低二 ,REF(LOW,BARSLAST(低点))+上左差*0.618,DRAWNULL),DOTLINE,COLOR4080FF;
上1000:IF(上下类型=1 AND 低一>=低二 ,REF(LOW,BARSLAST(低点))+上左差*1,DRAWNULL),COLOR4080FF;
上1382:IF(上下类型=1 AND 低一>=低二 ,REF(LOW,BARSLAST(低点))+上左差*1.382,DRAWNULL),DOTLINE,COLOR4080FF;
上1618:IF(上下类型=1 AND 低一>=低二 ,REF(LOW,BARSLAST(低点))+上左差*1.618,DRAWNULL),DOTLINE,COLOR4080FF;
上2000:IF(上下类型=1 AND 低一>=低二 ,REF(LOW,BARSLAST(低点))+上左差*2,DRAWNULL),COLOR4080FF;
DRAWTEXT(上下类型=1 AND 低一>=低二 AND 低点,上底线,VARCAT(' 0000% ',CON2STR(上底线,2))),COLORGRAY;
DRAWTEXT(上下类型=1 AND 低一>=低二 AND 低点,上382,VARCAT(' 0382% ',CON2STR(上382,2))),COLORGRAY;
DRAWTEXT(上下类型=1 AND 低一>=低二 AND 低点,上618,VARCAT(' 0618% ',CON2STR(上618,2))),COLORGRAY;
DRAWTEXT(上下类型=1 AND 低一>=低二 AND 低点,上1000,VARCAT(' 1000% ',CON2STR(上1000,2))),COLORGRAY;
DRAWTEXT(上下类型=1 AND 低一>=低二 AND 低点,上1382,VARCAT(' 1382% ',CON2STR(上1382,2))),COLORGRAY;
DRAWTEXT(上下类型=1 AND 低一>=低二 AND 低点,上1618,VARCAT(' 1618% ',CON2STR(上1618,2))),COLORGRAY;
DRAWTEXT(上下类型=1 AND 低一>=低二 AND 低点,上2000,VARCAT(' 2000% ',CON2STR(上2000,2))),COLORGRAY;
下左差:=REF(HIGH,BARSLAST(点1位))-REF(LOW,BARSLAST(低点)),NODRAW;
下顶线:IF(上下类型=0 AND 高一<高二,REF(HIGH,BARSLAST(高点))-下左差*0,DRAWNULL),COLOR008000;
下382:IF(上下类型=0 AND 高一<高二,REF(HIGH,BARSLAST(高点))-下左差*0.382,DRAWNULL),DOTLINE,COLOR008000;
下618:IF(上下类型=0 AND 高一<高二,REF(HIGH,BARSLAST(高点))-下左差*0.682,DRAWNULL),DOTLINE,COLOR008000;
下1000:IF(上下类型=0 AND 高一<高二,REF(HIGH,BARSLAST(高点))-下左差*1,DRAWNULL),COLOR008000;
下1382:IF(上下类型=0 AND 高一<高二,REF(HIGH,BARSLAST(高点))-下左差*1.382,DRAWNULL),DOTLINE,COLOR008000;
下1618:IF(上下类型=0 AND 高一<高二,REF(HIGH,BARSLAST(高点))-下左差*1.618,DRAWNULL),DOTLINE,COLOR008000;
下2000:IF(上下类型=0 AND 高一<高二,REF(HIGH,BARSLAST(高点))-下左差*2,DRAWNULL),COLOR008000;
DRAWTEXT(上下类型=0 AND 高一<高二 AND 高点,下顶线,VARCAT(' 0000% ',CON2STR(下顶线,2))),COLORGRAY;
DRAWTEXT(上下类型=0 AND 高一<高二 AND 高点,下382,VARCAT(' 0382% ',CON2STR(下382,2))),COLORGRAY;
DRAWTEXT(上下类型=0 AND 高一<高二 AND 高点,下618,VARCAT(' 0618% ',CON2STR(下618,2))),COLORGRAY;
DRAWTEXT(上下类型=0 AND 高一<高二 AND 高点,下1000,VARCAT(' 1000% ',CON2STR(下1000,2))),COLORGRAY;
DRAWTEXT(上下类型=0 AND 高一<高二 AND 高点,下1382,VARCAT(' 1382% ',CON2STR(下1382,2))),COLORGRAY;
DRAWTEXT(上下类型=0 AND 高一<高二 AND 高点,下1618,VARCAT(' 1618% ',CON2STR(下1618,2))),COLORGRAY;
DRAWTEXT(上下类型=0 AND 高一<高二 AND 高点,下2000,VARCAT(' 2000% ',CON2STR(下2000,2))),COLORGRAY;
STICKLINE(上下类型 AND 低点,LOW,上2000,0,0),COLOR4080FF;
STICKLINE(上下类型 AND 低点,LOW,上1000,0,0),COLOR4080FF;
STICKLINE(上下类型=0 AND 高点,H,下2000,0,0),COLOR008000;
{////////////////////////////智能化波段尺//////////////////////////////////};
ABC:=低一<低二 AND 上下类型=1;
{分析家公式网 WWW.70822.COM 整理}
STICKLINE(VV AND 低一<低二 ,高一,低一,0,1),COLOR4080FF;
STICKLINE(VV2 AND 低一<低二 ,高一,低一,0,0),COLOR4080FF;
A382:低一-(低一-高一)*(0.382)*ABC,DOTLINE,COLOR4080FF;
A50:低一-(低一-高一)*(0.50)*ABC,COLOR4080FF;
A618:低一-(低一-高一)*(0.618)*ABC,DOTLINE,COLOR4080FF;
DRAWTEXT( 低一,A382*1.01,VARCAT(' 1.00% ',CON2STR(A382,2))),COLOR4080FF;
YYP:=BACKSET(ISLASTBAR,BARSLAST(VV OR VV2)+1) AND ABC=1 AND REF(BACKSET(ISLASTBAR,BARSLAST(VV OR VV2)+1),1)=0;
DRAWTEXT(YYP ,高一,VARCAT(' 1000% ',CON2STR(高一,2))),COLORGRAY;
DRAWTEXT(YYP ,A382,VARCAT(' 0382% ',CON2STR(A382,2))),COLORGRAY;
DRAWTEXT(YYP ,A50,VARCAT(' 0500% ',CON2STR(A50,2))),COLORGRAY;
DRAWTEXT(YYP ,A618,VARCAT(' 0618% ',CON2STR(A618,2))),COLORGRAY;
DRAWTEXT(YYP ,低一,VARCAT(' 0000% ',CON2STR(低一,2))),COLORGRAY;
①23:=高一>高二 AND 上下类型=0;
{STICKLINE(VV,高一,低一,0,1),COLOR4080FF;};
STICKLINE(VV2 AND ①23=1 ,高一,低一,0,0),COLOR4080FF;
①382:低一-(低一-高一)*(0.382)*①23,DOTLINE,COLOR4080FF;
①50:低一-(低一-高一)*(0.50)*①23,COLOR4080FF;
①618:低一-(低一-高一)*(0.618)*①23,DOTLINE,COLOR4080FF;
DRAWTEXT( 低一,①382*1.01,VARCAT(' 1.00% ',CON2STR(①382,2))),COLOR4080FF;
YYPP:BACKSET(ISLASTBAR,BARSLAST(VV OR VV2)+1) AND REF(BACKSET(ISLASTBAR,BARSLAST(VV OR VV2)+1),1)=0 AND 上下类型=0;
DRAWTEXT(YYPP AND ①23=1,高一,VARCAT(' 1000% ',CON2STR(高一,2))),COLORGRAY;
DRAWTEXT(YYPP AND ①23=1,①382,VARCAT(' 0382% ',CON2STR(①382,2))),COLORGRAY;
DRAWTEXT(YYPP AND ①23=1,①50,VARCAT(' 0500% ',CON2STR(①50,2))),COLORGRAY;
DRAWTEXT(YYPP AND ①23=1,①618,VARCAT(' 0618% ',CON2STR(①618,2))),COLORGRAY;
DRAWTEXT(YYPP AND ①23=1,低一,VARCAT(' 0000% ',CON2STR(低一,2))),COLORGRAY;
原文链接:https://www.tdxzb.com/?id=803
本文版权:如无特别标注,本站文章均为原创。