通达信指标公式源码概况:
指标类别: 通达信指标公式
授权方式: 免费版
指标评级: ★★★★★
指标分类: 策略
画线方法: 副图
一、通达信缠论买卖指标公式
{N1:1,100,10;N2:1,100,10;DISP:=1,3,2};
N1:=10;N2:=10;DISP:=2;
K:=IF(PERIOD=5,1,{日}
IF(PERIOD=6,1,{周}
IF(PERIOD=7,1,{月}
IF(PERIOD=8,1,{多分钟}
IF(PERIOD=9,1,{多日}
IF(PERIOD=10,1,{季}
IF(PERIOD=11,2,{年}
IF(PERIOD=4,1,{60F}
IF(PERIOD=3,1,{30F}
IF(PERIOD=2,1,{15F}
IF(PERIOD=1,1{5F},1{1F})))))))))))/10;
P1:=PEAK(1,K*N1,1);
P2:=PEAK(1,K*N1,2);
WP1:=PEAKBARS(1,K*N1,1);
WP2:=PEAKBARS(1,K*N1,2);
T1:=TROUGH(2,K*N2,1);
T2:=TROUGH(2,K*N2,2);
WT1:=TROUGHBARS(2,K*N2,1);
WT2:=TROUGHBARS(2,K*N2,2);
TJ1:=P1>T1ANDP2>T2;
ZD:=MAX(T1,T2);
ZG:=MIN(P1,P2);
LL:=MIN(T1,T2);
HH:=MAX(P1,P2);
TJ2:=FILTER(ZG>ZD,2);
TJ3:=ZG=REF(ZG,BARSLAST(TJ2))ORZD=REF(ZD,BARSLAST(TJ2));
TJ4:=TJ1&&TJ2&&NOT(TJ3);
TJ5:=BETWEEN(ZD,REF(ZD,REF(BARSLAST(TJ4),1)),REF(ZG,REF(BARSLAST(TJ4),1)));
TJ6:=BETWEEN(ZG,REF(ZD,REF(BARSLAST(TJ4),1)),REF(ZG,REF(BARSLAST(TJ4),1)));
TJ7:=ZG>REF(ZG,REF(BARSLAST(TJ4),1))&&ZD<REF(ZD,REF(BARSLAST(TJ4),1));
TJ8:=TJ4&&NOT(TJ5ORTJ6ORTJ7);
ZSD:=IF(TJ8,ZD,DRAWNULL);
ZSG:=IF(TJ8,ZG,DRAWNULL);
ZSH:=IF(TJ8,HH,DRAWNULL);
ZSL:=IF(TJ8,LL,DRAWNULL);
STICKLINE(TJ8,ZSH,ZSL,0,-1),COLORMAGENTA;
STICKLINE(TJ8,ZSD,ZSG,IF(DISP=1,3,0),1),COLORMAGENTA;
DRAWTEXT(DISP=2,ZSH,'中枢'),COLORWHITE;
中枢高:PLOYLINE(DISP=2,REF(ZSD,BARSLAST(TJ8))),CIRCLEDOT,COLORLIRED;
中枢低:PLOYLINE(DISP=2,REF(ZSG,BARSLAST(TJ8))),CIRCLEDOT,COLORLIGREEN;
{中枢最高:PLOYLINE(DISP=2,REF(ZSH,BARSLAST(TJ8))),POINTDOT,COLORRED;
中枢最低:PLOYLINE(DISP=2,REF(ZSL,BARSLAST(TJ8))),POINTDOT,COLORGREEN;}
趋势高:PLOYLINE(DISP=3,ZIG(1,K*N1)),COLORLIBLUE;
趋势低:PLOYLINE(DISP=3,ZIG(2,K*N2)),COLORLIBLUE;
局部低点预选A:=BACKSET(LLV(L,5)<REF(LLV(L,4),1),4);
局部低点预选B:=BACKSET(局部低点预选A=0ANDREF(局部低点预选A,1)=1,2);
局部低点预选C:=IF(局部低点预选B=1ANDREF(局部低点预选B,1)=0,-1,0);
局部高点预选A:=BACKSET(HHV(H,5)>REF(HHV(H,4),1),4);
局部高点预选B:=BACKSET(局部高点预选A=0ANDREF(局部高点预选A,1)=1,2);
局部高点预选C:=IF(局部高点预选B=1ANDREF(局部高点预选B,1)=0,1,0);
缺口判断:=IF(L>REF(H,1),1,IF(H<REF(L,1),-1,0));
距前高天:=BARSLAST(局部高点预选C=1);
距前低天:=BARSLAST(局部低点预选C=-1);
小值周期:=LOWRANGE(L);
大值周期:=TOPRANGE(H);
低保留AA:=IF(局部低点预选C=-1ANDREF(距前高天,1)>REF(距前低天,1)ANDLLV(L,距前高天
+1)<REF(LLV(L,距前高天+1),1),-1,0);
低保留AB:=IF(局部低点预选C=-1ANDREF(距前高天,1)<=REF(距前低天,1)AND(距前高天>=4
ORLLV(缺口判断,距前高天)=-1ORLLV(L,距前低天+2)<REF(LLV(L,距前低天+1),1)),-1,0);
低保留S:=IF((低保留AA=-1OR低保留AB=-1)ANDL<REF(H,距前高天+1),-1,0);
预判:=IF((距前低天<4ANDHHV(缺口判断,距前低天)!=1)ORREF(低保留S,距前低天)=0,1,0);
判断:=IF(局部高点预选C=1ANDREF(距前低天,1)<=REF(距前高天,1)AND预判=1AND大值周
期>REF(小值周期,距前低天+1)AND大值周期>REF(小值周期,距前低天)AND大值周期>REF(大值周期,距前高天),1,0);
高保留A:=IF(局部高点预选C=1ANDREF(距前低天,1)>REF(距前高天,1)ANDHHV(H,距前低天
+1)>REF(HHV(H,距前低天+1),1),1,0);
高保留B:=IF(局部高点预选C=1ANDREF(距前低天,1)<=REF(距前高天,1)ANDREF(低保留S,
距前低天)=-1AND(距前低天>=4ORHHV(缺口判断,距前低天)=1),1,0);
高保留:=IF((高保留A=1OR高保留B=1OR判断=1)ANDH>REF(L,距前低天+1),1,0);
预判A:=IF((距前高天<4ANDHHV(缺口判断,距前高天)!=1)ORREF(高保留,距前高天)=0,1,0);
判断A:=IF(局部低点预选C=-1ANDREF(距前高天,1)<=REF(距前低天,1)AND预判A=1AND
小值周期>REF(大值周期,距前高天+1)AND小值周期>REF(大值周期,距前高天)AND小值周
期>REF(小值周期,距前低天),-1,0);
低保留A:=IF(局部低点预选C=-1ANDREF(距前高天,1)>REF(距前低天,1)ANDLLV(L,距前高天
+1)<REF(LLV(L,距前高天+1),1),-1,0);
低保留B:=IF(局部低点预选C=-1ANDREF(距前高天,1)<=REF(距前低天,1)AND(距前高天>=4
ORLLV(缺口判断,距前高天)=-1OR判断A=-1),-1,0);
低保留:=IF((低保留A=-1OR低保留B=-1)ANDL<REF(H,距前高天+1),-1,0);
距前高天A:=BARSLAST(高保留=1);
距前低天A:=BARSLAST(低保留=-1);
预判X:=IF((距前低天A<4ANDHHV(缺口判断,距前低天A)!=1)ORREF(低保留,距前低天
A)=0,1,0);
判断X:=IF(局部高点预选C=1ANDREF(距前低天A,1)<=REF(距前高天A,1)AND预判X=1AND
大值周期>REF(小值周期,距前低天A+1)AND大值周期>REF(小值周期,距前低天A)AND大值周
期>REF(大值周期,距前高天A),1,0);
高保留XA:=IF(局部高点预选C=1ANDREF(距前低天A,1)>REF(距前高天A,1)ANDHHV(H,距前
低天A+1)>REF(HHV(H,距前低天A+1),1),1,0);
高保留XB:=IF(局部高点预选C=1ANDREF(距前低天A,1)<=REF(距前高天A,1)ANDREF(低保
留,距前低天A)=-1AND(距前低天A>=4ORHHV(缺口判断,距前低天A)=1),1,0);
高保留X:=IF((高保留XA=1OR高保留XB=1OR判断X=1)ANDH>REF(L,距前低天A+1),1,0);
预判XA:=IF((距前高天A<4ANDHHV(缺口判断,距前高天A)!=1)ORREF(高保留XA,距前高天
A)=0,1,0);
判断XA:=IF(局部低点预选C=-1ANDREF(距前高天A,1)<=REF(距前低天A,1)AND预判XA=1
AND小值周期>REF(大值周期,距前高天A+1)AND小值周期>REF(大值周期,距前高天A)AND
小值周期>REF(小值周期,距前低天A),-1,0);
低保留XA:=IF(局部低点预选C=-1ANDREF(距前高天A,1)>REF(距前低天A,1)ANDLLV(L,距前
高天A+1)<REF(LLV(L,距前高天A+1),1),-1,0);
低保留XB:=IF(局部低点预选C=-1ANDREF(距前高天A,1)<=REF(距前低天A,1)AND(距前高天
A>=4ORLLV(缺口判断,距前高天A)=-1OR判断XA=-1),-1,0);
低保留X:=IF((低保留XA=-1OR低保留XB=-1)ANDL<REF(H,距前高天A+1),-1,0);
距前高天YA:=BARSLAST(高保留X=1);
距前低天YA:=BARSLAST(低保留X=-1);
预判YX:=IF((距前低天YA<4ANDHHV(缺口判断,距前低天YA)!=1)ORREF(低保留X,距前低天
YA)=0,1,0);
判断YX:=IF(局部高点预选C=1ANDREF(距前低天YA,1)<=REF(距前高天YA,1)AND预判YX=1
AND大值周期>REF(小值周期,距前低天YA+1)AND大值周期>REF(小值周期,距前低天YA)
AND大值周期>REF(大值周期,距前高天YA),1,0);
高保留YXA:=IF(局部高点预选C=1ANDREF(距前低天YA,1)>REF(距前高天YA,1)ANDHHV(H,
距前低天YA+1)>REF(HHV(H,距前低天YA+1),1),1,0);
MA60:MA(C,60),LINETHICK3,COLORGREEN;
A1:=REF(H,8)=HHV(H,2*8+1);
B1:=FILTER(A1,8);
C1:=BACKSET(B1,8+1);
D1:=FILTER(C1,8);{高点}
R11:=BACKSET(ISLASTBAR,BARSLAST(D1)+1);
S11:=R11>REF(R11,1);
DRAWLINE(D1,H,S11,H,1),COLORBLUE;
A2:=REF(L,8)=LLV(L,2*8+1);
B2:=FILTER(A2,8);
C2:=BACKSET(B2,8+1);
D2:=FILTER(C2,8);{低点}
T11:=BACKSET(ISLASTBAR,BARSLAST(D2)+1);
U11:=T11>REF(T11,1);
DRAWLINE(D2,L,U11,L,1),COLORBLUE;
M:=INTPART(3*8/5);
A12:=REF(H,M)=HHV(H,2*M+1);
B12:=FILTER(A12,M);
C12:=BACKSET(B12,M+1);
D12:=FILTER(C12,M);{高点}
R112:=BACKSET(ISLASTBAR,BARSLAST(D12)+1);
S112:=R112>REF(R112,1);
DRAWLINE(D12,H,S112,H,1),COLORRED;
A22:=REF(L,M)=LLV(L,2*M+1);
B22:=FILTER(A22,M);
C22:=BACKSET(B22,M+1);
D22:=FILTER(C22,M);{低点}
T112:=BACKSET(ISLASTBAR,BARSLAST(D22)+1);
U112:=T112>REF(T112,1);
DRAWLINE(D22,L,U112,L,1),COLORRED;
VAR1111:=BACKSET(REF(HIGH,2)=HHV(HIGH,5),3);
VAR2222:=CROSS(VAR1111,0.9);
VAR3333:=BACKSET(REF(LOW,2)=LLV(LOW,5),3);
VAR4444:=CROSS(VAR3333,0.9);
压力:=REF(HIGH,BARSLAST(VAR2222));
STICKLINE(CLOSE,REF(HIGH,BARSLAST(VAR2222)),REF(HIGH
,BARSLAST(VAR2222)),0.5,1),COLOREA91B5,LINETHICK3;
支撑:=REF(LOW,BARSLAST(VAR4444));
STICKLINE(CLOSE,REF(LOW,BARSLAST(VAR4444)),REF(LOW,
BARSLAST(VAR4444)),0.5,1),COLOR00B4FF,LINETHICK3;
下档线:=(((CLOSE-LLV(LOW,13))/(HHV(HIGH,13)-
LLV(LOW,13)))*100);
RRRSV:=SMA(下档线,3,1);
KKK:=SMA(RRRSV,3,1);
DDD:=((3*RRRSV)-(2*KKK));
JJ12:=(((CLOSE
LLV(LOW,55)))*100);
RSV24:=SMA(JJ12,3,1);
K24:=SMA(RSV24,3,1);
D24:=((3*RSV24)-(2*K24));
压
DDD)))),COLORFFFFFF;
压力位:=IF(ISLASTBAR,压力2,DRAWNULL);
STICKLINE(ISLASTBAR,压力位,压力位,120,0),LINETHICK4,COLORFFFFFF;
底部:=LLV(HIGH,30),COLOR00FF00;
底部位:=IF(ISLASTBAR,底部,DRAWNULL);
力
2:=IF(CROSS(D24,DDD),HIGH,REF(HIGH,BARSLAST(CROSS(D24,
-LLV(LOW,55))/(HHV(HIGH,55)-
STICKLINE(ISLASTBAR,底部位,底部位,100,0),LINETHICK4,COLOR00FF00;
二、通达信缠论买卖点公式
-CAL-FENGHAI.-(YICAI)-CompanyOne1
中枢.
MA1:MA(CLOSE,5);
MA2:MA(CLOSE,10);
{N1:1,100,10;N2:1,100,10;DISP:=1,3,2};
N1:=10;N2:=10;DISP:=2;
K:=IF(PERIOD=5,1,{日}
IF(PERIOD=6,1,{周}
IF(PERIOD=7,1,{月}
IF(PERIOD=8,1,{多分钟}
IF(PERIOD=9,1,{多日}
IF(PERIOD=10,1,{季}
IF(PERIOD=11,2,{年}
IF(PERIOD=4,1,{60F}
IF(PERIOD=3,1,{30F}
IF(PERIOD=2,1,{15F}
IF(PERIOD=1,1{5F},1{1F})))))))))))/10;
P1:=PEAK(1,K*N1,1);
P2:=PEAK(1,K*N1,2);
WP1:=PEAKBARS(1,K*N1,1);
WP2:=PEAKBARS(1,K*N1,2);
T1:=TROUGH(2,K*N2,1);
T2:=TROUGH(2,K*N2,2);
WT1:=TROUGHBARS(2,K*N2,1);
WT2:=TROUGHBARS(2,K*N2,2);
TJ1:=P1>T1ANDP2>T2;
ZD:=MAX(T1,T2);
ZG:=MIN(P1,P2);
LL:=MIN(T1,T2);
HH:=MAX(P1,P2);
TJ2:=FILTER(ZG>ZD,2);
TJ3:=ZG=REF(ZG,BARSLAST(TJ2))ORZD=REF(ZD,BARSLAST(TJ2));
TJ4:=TJ1&&TJ2&&NOT(TJ3);
PL5:=ZIG(3,5);
EN1:=ZIG(3,5)>REF(ZIG(3,5),1)ANDREF(ZIG(3,5),1)<=REF(ZIG(3,5),2)AND
REF(ZIG(3,5),2)<=REF(ZIG(3,5),3);
EX1:=ZIG(3,5)<REF(ZIG(3,5),1)ANDREF(ZIG(3,5),1)>=REF(ZIG(3,5),2)AND
REF(ZIG(3,5),2)>=REF(ZIG(3,5),3);
PL10:=ZIG(3,13);
EN2:=ZIG(3,10)>REF(ZIG(3,10),1)ANDREF(ZIG(3,10),1)<=REF(ZIG(3,10),2)AND
REF(ZIG(3,10),2)<=REF(ZIG(3,10),3);
EX2:=ZIG(3,10)<REF(ZIG(3,10),1)ANDREF(ZIG(3,10),1)>=REF(ZIG(3,10),2)AND
REF(ZIG(3,10),2)>=REF(ZIG(3,10),3);
PL20:=ZIG(3,26);
EN3:=ZIG(3,20)>REF(ZIG(3,20),1)ANDREF(ZIG(3,20),1)<=REF(ZIG(3,20),2)AND
REF(ZIG(3,20),2)<=REF(ZIG(3,20),3);
EX3:=ZIG(3,20)<REF(ZIG(3,20),1)ANDREF(ZIG(3,20),1)>=REF(ZIG(3,20),2)AND
REF(ZIG(3,20),2)>=REF(ZIG(3,20),3);
PL40:=ZIG(3,55);
走强一:=BARSLAST(PL5<REF(PL5,1));
走弱一:=BARSLAST(PL5>REF(PL5,1));
走强二:=BARSLAST(PL10<REF(PL10,1));
走弱二:=BARSLAST(PL10>REF(PL10,1));
走强三:=BARSLAST(PL20<REF(PL20,1));
走弱三:=BARSLAST(PL20>REF(PL20,1));
ZTJZ5:=IF(PL10>REF(PL10,1),COUNT(EN1,走强二),0);
ZTJD5:=IF(PL10>REF(PL10,1),COUNT(EX1,走强二),0);
DTJZ5:=IF(PL10<REF(PL10,1),COUNT(EN1,走弱二),0);
DTJD5:=IF(PL10<REF(PL10,1),COUNT(EX1,走弱二),0);
ZTJZ10:=IF(PL20>REF(PL20,1),COUNT(EN2,走强三),0);
ZTJD10:=IF(PL20>REF(PL20,1),COUNT(EX2,走强三),0);
DTJZ10:=IF(PL20<REF(PL20,1),COUNT(EN2,走弱三),0);
DTJD10:=IF(PL20<REF(PL20,1),COUNT(EX2,走弱三),0);
DRAWTEXT(EN1ANDDTJZ5=1,LOW*0.98,'(Ⅰ)'),COLORFFFF00;
DRAWTEXT(EX1ANDDTJD5=2,HIGH*1.02,'(Ⅱ)'),COLORFFFF00;
DRAWTEXT(EN2ANDZTJZ5=1,LOW*0.98,'(Ⅲ)'),COLORFFFF00;
DRAWTEXT(EX1ANDPL10>REF(PL10,1)ANDZTJD5=1,HIGH*1.02,'⑴'),COLOR0000FF;
DRAWTEXT(EN1ANDPL10>REF(PL10,1)ANDZTJZ5=2,LOW*0.98,'⑵'),COLOR0000FF;
DRAWTEXT(EX1ANDPL10>REF(PL10,1)ANDZTJZ5=2,HIGH*1.02,'⑶'),COLOR0000FF;
DRAWTEXT(EN1ANDPL10>REF(PL10,1)ANDZTJZ5=3,LOW*0.98,'⑷'),COLOR0000FF;
DRAWTEXT(EX2ANDPL20>REF(PL20,1)ANDZTJD10=1,HIGH*1.02,'⑸'),COLOR0000FF;
DRAWTEXT(EN2ANDDTJZ10=1,LOW*0.94,'【A】'),COLOR00FF00;
DRAWTEXT(EX2ANDDTJD10=2,HIGH*1.03,'【B】'),COLOR00FF00;
DRAWTEXT(EN3ANDZTJZ10=1,LOW*0.94,'【C】'),COLOR00FF00;
DRAWTEXT(EX2ANDPL20>REF(PL20,1)ANDZTJD10=1,HIGH*1.04,'①
'),LINETHICK3,COLOR00FFFF;
DRAWTEXT(EN2ANDPL20>REF(PL20,1)ANDZTJZ10=2,LOW*0.94,'②
'),LINETHICK3,COLOR00FFFF;
DRAWTEXT(EX2ANDPL20>REF(PL20,1)ANDZTJD10=2OR(ZTJD10=0ORZTJD10=2)
ANDEX2,HIGH*1.04,'③'),LINETHICK3,COLOR00FFFF;
DRAWTEXT(EN2ANDPL20>REF(PL20,1)ANDZTJZ10=3,LOW*0.94,'④
'),LINETHICK3,COLOR00FFFF;
DMLJ:=HHV(HIGH,120);
TY:=CLOSE;
HD:=FILTER(BACKSET(FILTER(REF(TY,10)=HHV(TY,2*10+1),10),10+1),10);
LD:=FILTER(BACKSET(FILTER(REF(TY,10)=LLV(TY,2*10+1),10),10+1),10);
A:=REF(CLOSE,BARSLAST(HD));
B:=REF(CLOSE,BARSLAST(LD));
T1:=BARSLAST(HD)<BARSLAST(LD)ANDNOT(HD);
T2:=BARSLAST(HD)>BARSLAST(LD)ANDNOT(LD);
波浪顶:IF(T1,A,A),COLORFF00FF,POINTDOT,LINETHICK2;
STICKLINE(T1,A,A,9,0),COLORFF00FF;
波浪底:IF(T2,B,B),COLOR80FF00,POINTDOT,LINETHICK2;
VAR3:=LLV(HIGH,240);
VAR4:=100*(CLOSE-VAR3)/VAR3;
VAR5:=(CLOSE-LLV(LOW,528))/(HHV(HIGH,528)-LLV(LOW,528))*100;
VAR6:=(CLOSE-LLV(CLOSE,530))/(HHV(CLOSE,530)-LLV(CLOSE,530))*100;
VAR7:=0;
VAR8:=MA(HHV(CLOSE-REF(CLOSE,1),0),34)/MA(ABS(CLOSE-REF(CLOSE,1)),7)*100;
VAR9:=MA(HHV(CLOSE-REF(CLOSE,1),0),13)/MA(ABS(CLOSE-REF(CLOSE,1)),13)*100;
VARA:=BARSCOUNT(CLOSE);
VARB:=VAR8<20ANDVAR9<23ANDVARA>35;
VARC:=VARBANDCOUNT(VARB,1)=1;
VARD:=EMA(CLOSE,21)-EMA(CLOSE,8);
VARE:=EMA(VARD,5);
VARF:=TROUGH(3,6,1)<4ANDCROSS(VARD,VARE);
VAR10:=IF(TROUGH(3,16,1)=0ANDHIGH>LOW+0.04,4,0);
VAR11:=ZIG(3,6)>REF(ZIG(3,6),1)ANDREF(ZIG(3,6),1)<=REF(ZIG(3,6),2)AND
REF(ZIG(3,6),2)<=REF(ZIG(3,6),3);
VAR12:=ZIG(3,6)<REF(ZIG(3,6),1)ANDREF(ZIG(3,6),1)>=REF(ZIG(3,6),2)AND
REF(ZIG(3,6),2)>=REF(ZIG(3,6),3);
VAR13:=ZIG(3,22)>REF(ZIG(3,22),1)ANDREF(ZIG(3,22),1)<=REF(ZIG(3,22),2)AND
REF(ZIG(3,22),2)<=REF(ZIG(3,22),3);
VAR14:=ZIG(3,22)<REF(ZIG(3,22),1)ANDREF(ZIG(3,22),1)>=REF(ZIG(3,22),2)AND
REF(ZIG(3,22),2)>=REF(ZIG(3,22),3);
VAR15:=ZIG(3,51)>REF(ZIG(3,51),1)ANDREF(ZIG(3,51),1)<=REF(ZIG(3,51),2)AND
REF(ZIG(3,51),2)<=REF(ZIG(3,51),3);
VAR16:=ZIG(3,51)<REF(ZIG(3,51),1)ANDREF(ZIG(3,51),1)>=REF(ZIG(3,51),2)AND
REF(ZIG(3,51),2)>=REF(ZIG(3,51),3);
VAR17:=ZIG(3,72)>REF(ZIG(3,72),1)ANDREF(ZIG(3,72),1)<=REF(ZIG(3,72),2)AND
REF(ZIG(3,72),2)<=REF(ZIG(3,72),3);
VAR18:=ZIG(3,72)<REF(ZIG(3,72),1)ANDREF(ZIG(3,72),1)>=REF(ZIG(3,72),2)AND
REF(ZIG(3,72),2)>=REF(ZIG(3,72),3);
VAR19:=EMA(CLOSE,2)-EMA(CLOSE,150);
VAR1A:=EMA(VAR19,100);
VAR1B:=2*(VAR19-VAR1A);
VAR1C:=POW(VAR1B,3)*0.1+POW(VAR1B,1);
VAR1D:=SQRT(SQRT(LOW*HIGH*OPEN*CLOSE));
VAR1E:=EMA(VAR1D*0.97,3);
VAR1F:=(HIGH+LOW+CLOSE)/3;
VAR20:=(VAR1F-MA(VAR1F,14))/(0.015*AVEDEV(VAR1F,14));
VAR21:=CROSS(VAR1E,LOW);
买点一:=VAR10;
买点二:=(VAR11+VAR13+VAR15+VAR17);
卖点一:=(VAR12+VAR14+VAR16+VAR18);
VAR22:=买点一ANDVARFANDVARCANDVAR21ANDVAR4<0ANDVAR5=0AND
VAR6=0ANDVAR20<(-110);
VAR1:=MA(CLOSE,6);
VAR2:=MA(CLOSE,18);
VAR31:=MA(CLOSE,30);
VARB1:=SUM(CLOSE*VOL*100,28)/SUM(VOL*100,28);
VARC1:=INTPART(VARB1*100)/100;
VARD1:=EMA(CLOSE,5)-EMA(CLOSE,10);
VARE1:=EMA(VARD1,9);
VAR131:=REF(VARE1,1);
VAR141:=VARE1;
VAR151:=VAR141-VAR131;
VAR161:=REF(VARD1,1);
VAR171:=VARD1;
VAR181:=VAR171-VAR161;
VAR191:=OPEN;
VAR1A1:=CLOSE;
DRAWTEXT(买点一>0,LOW-0.01,'▲买!'),COLORRED;
DRAWTEXT(买点二>0,LOW-0.01,'▲I淘金点'),COLORYELLOW;
DRAWTEXT(卖点一>0,HIGH+0.1,''),COLORWHITE;
A1:=BARSCOUNT(CLOSE);
AH:=HHV(HIGH,72);
AL:=LLV(LOW,72);
A0:=(AH-AL)/21;
B1:=LOW-A0;
DRAWTEXT((A1+0)/15=FLOOR((A1+0)/15),B1-2.5*A0,'▲时窗'),COLORWHITE;
VAR51:=HHVBARS(ZIG(3,19)>REF(ZIG(3,19),1)
ANDREF(ZIG(3,19),1)<REF(ZIG(3,19),2),0);
STICKLINE(VAR51=2,LOW*0.95,LOW*0.98,8,0),COLOR0000FF;
DRAWTEXT(VAR51=2,LOW*0.95,'3天'),COLORWHITE;
STICKLINE(VAR51=4,HIGH*1.05,HIGH*1.02,8,0),COLOR9966FF;
DRAWTEXT(VAR51=4,HIGH*1.06,'5天'),COLORWHITE;
STICKLINE(VAR51=7,LOW*0.95,LOW*0.98,8,0),COLOR00FFFF;
DRAWTEXT(VAR51=7,LOW*0.95,'8天'),COLORWHITE;
STICKLINE(VAR51=12,HIGH*1.05,HIGH*1.02,8,0),COLORFF33FF;
DRAWTEXT(VAR51=12,HIGH*1.06,'13天'),COLORWHITE;
STICKLINE(VAR51=20,LOW*0.95,LOW*0.98,8,0),COLOR0066FF;
DRAWTEXT(VAR51=20,LOW*0.95,'21天'),COLORWHITE;
STICKLINE(VAR51=33,HIGH*1.05,HIGH*1.02,8,0),COLORFFFF00;
DRAWTEXT(VAR51=33,HIGH*1.06,'34天'),COLORWHITE;
STICKLINE(VAR51=54,LOW*0.95,LOW*0.98,8,0),COLORWHITE;
DRAWTEXT(VAR51=54,LOW*0.95,'55天'),COLORWHITE;
STICKLINE(VAR51=88,HIGH*1.05,HIGH*1.02,8,0),COLOR00FF00;
DRAWTEXT(VAR51=88,HIGH*1.06,'89天'),COLORWHITE;
STICKLINE(VAR51=143,LOW*0.95,LOW*0.98,8,0),COLORCCFFFF;
DRAWTEXT(VAR51=143,LOW*0.95,'144天'),COLORWHITE;
STICKLINE(VAR51=232,HIGH*1.05,HIGH*1.02,8,0),COLORFF0033;
DRAWTEXT(VAR51=232,HIGH*1.06,'233天'),COLORWHITE;
STICKLINE(VAR51=376,LOW*0.95,LOW*0.98,8,0),COLORFF9966;
DRAWTEXT(VAR51=376,LOW*0.95,'377天'),COLORWHITE;
立春:=FILTER(MONTH=2AND(DAY=3ORDAY=5),2);
雨水:=FILTER(MONTH=2AND(DAY=18ORDAY=20),2);
惊蛰:=FILTER(MONTH=3AND(DAY=5ORDAY=7),2);
春分:=FILTER(MONTH=3AND(DAY=20ORDAY=22),2);
清明:=FILTER(MONTH=4AND(DAY=3ORDAY=6),2);
谷雨:=FILTER(MONTH=4AND(DAY=19ORDAY=21),2);
立夏:=FILTER(MONTH=5AND(DAY=6ORDAY=8),2);
小满:=FILTER(MONTH=5AND(DAY=20ORDAY=22),2);
芒种:=FILTER(MONTH=6AND(DAY=5ORDAY=7),2);
夏至:=FILTER(MONTH=6AND(DAY=20ORDAY=22),2);
小暑:=FILTER(MONTH=7AND(DAY=6ORDAY=8),2);
大署:=FILTER(MONTH=7AND(DAY=22ORDAY=24),2);
立秋:=FILTER(MONTH=8AND(DAY=7ORDAY=9),2);
处暑:=FILTER(MONTH=8AND(DAY=22ORDAY=24),2);
白露:=FILTER(MONTH=9AND(DAY=7ORDAY=9),2);
秋分:=FILTER(MONTH=9AND(DAY=22ORDAY=24),2);
寒露:=FILTER(MONTH=10AND(DAY=7ORDAY=9),2);
霜降:=FILTER(MONTH=10AND(DAY=22ORDAY=24),2);
立冬:=FILTER(MONTH=11AND(DAY=7ORDAY=9),2);
小雪:=FILTER(MONTH=11AND(DAY=22ORDAY=24),2);
大雪:=FILTER(MONTH=12AND(DAY=6ORDAY=8),2);
冬至:=FILTER(MONTH=12AND(DAY=21ORDAY=23),2);
小寒:=FILTER(MONTH=1AND(DAY=5ORDAY=7),2);
大寒:=FILTER(MONTH=1AND(DAY=19ORDAY=21),2);
DRAWTEXT(立春,HIGH*1.02,'立春');
DRAWTEXT(雨水,HIGH*1.02,'雨水');
DRAWTEXT(惊蛰,HIGH*1.02,'惊蛰');
DRAWTEXT(春分,HIGH*1.02,'春分');
MA1:MA(CLOSE,5);
MA2:MA(CLOSE,10);
{N1:1,100,10;N2:1,100,10;DISP:=1,3,2};
N1:=10;N2:=10;DISP:=2;
K:=IF(PERIOD=5,1,{日}
IF(PERIOD=6,1,{周}
IF(PERIOD=7,1,{月}
IF(PERIOD=8,1,{多分钟}
IF(PERIOD=9,1,{多日}
IF(PERIOD=10,1,{季}
IF(PERIOD=11,2,{年}
IF(PERIOD=4,1,{60F}
IF(PERIOD=3,1,{30F}
IF(PERIOD=2,1,{15F}
IF(PERIOD=1,1{5F},1{1F})))))))))))/10;
{这段是识别中枢}
{
P1:=PEAK(1,K*N1,1);
P2:=PEAK(1,K*N1,2);
WP1:=PEAKBARS(1,K*N1,1);
WP2:=PEAKBARS(1,K*N1,2);
T1:=TROUGH(2,K*N2,1);
T2:=TROUGH(2,K*N2,2);
WT1:=TROUGHBARS(2,K*N2,1);
WT2:=TROUGHBARS(2,K*N2,2);
TJ1:=P1>T1ANDP2>T2;
ZD:=MAX(T1,T2);
ZG:=MIN(P1,P2);
LL:=MIN(T1,T2);
HH:=MAX(P1,P2);
TJ2:=FILTER(ZG>ZD,2);
TJ3:=ZG=REF(ZG,BARSLAST(TJ2))ORZD=REF(ZD,BARSLAST(TJ2));
TJ4:=TJ1&&TJ2&&NOT(TJ3);
TJ5:=BETWEEN(ZD,REF(ZD,REF(BARSLAST(TJ4),1)),REF(ZG,REF(BARSLAST(TJ4),1)));
TJ6:=BETWEEN(ZG,REF(ZD,REF(BARSLAST(TJ4),1)),REF(ZG,REF(BARSLAST(TJ4),1)));
TJ7:=ZG>REF(ZG,REF(BARSLAST(TJ4),1))&&ZD<REF(ZD,REF(BARSLAST(TJ4),1));
TJ8:=TJ4&&NOT(TJ5ORTJ6ORTJ7);
ZSD:=IF(TJ8,ZD,DRAWNULL);
ZSG:=IF(TJ8,ZG,DRAWNULL);
ZSH:=IF(TJ8,HH,DRAWNULL);
ZSL:=IF(TJ8,LL,DRAWNULL);
STICKLINE(TJ8,ZSH,ZSL,0,-1),COLORMAGENTA;
STICKLINE(TJ8,ZSD,ZSG,IF(DISP=1,3,0),1),COLORMAGENTA;
DRAWTEXT(DISP=2,ZSH,'中枢'),COLORRED;
中枢高:PLOYLINE(DISP=2,REF(ZSD,BARSLAST(TJ8))),CROSSDOT,COLORLIRED;
中枢低:PLOYLINE(DISP=2,REF(ZSG,BARSLAST(TJ8))),CROSSDOT,COLORLIGREEN;
中枢最高:PLOYLINE(DISP=2,REF(ZSH,BARSLAST(TJ8))),POINTDOT,COLORRED;
中枢最低:PLOYLINE(DISP=2,REF(ZSL,BARSLAST(TJ8))),POINTDOT,COLORGREEN;
}
趋势高:PLOYLINE(DISP=3,ZIG(1,K*N1)),COLORLIBLUE;
趋势低:PLOYLINE(DISP=3,ZIG(2,K*N2)),COLORLIBLUE;
局部低点预选A:=BACKSET(LLV(L,5)<REF(LLV(L,4),1),4);
局部低点预选B:=BACKSET(局部低点预选A=0ANDREF(局部低点预选A,1)=1,2);
局部低点预选C:=IF(局部低点预选B=1ANDREF(局部低点预选B,1)=0,-1,0);
局部高点预选A:=BACKSET(HHV(H,5)>REF(HHV(H,4),1),4);
局部高点预选B:=BACKSET(局部高点预选A=0ANDREF(局部高点预选A,1)=1,2);
局部高点预选C:=IF(局部高点预选B=1ANDREF(局部高点预选B,1)=0,1,0);
缺口判断:=IF(L>REF(H,1),1,IF(H<REF(L,1),-1,0));
距前高天:=BARSLAST(局部高点预选C=1);
距前低天:=BARSLAST(局部低点预选C=-1);
小值周期:=LOWRANGE(L);
大值周期:=TOPRANGE(H);
低保留AA:=IF(局部低点预选C=-1ANDREF(距前高天,1)>REF(距前低天,1)ANDLLV(L,距
前高天+1)<REF(LLV(L,距前高天+1),1),-1,0);
低保留AB:=IF(局部低点预选C=-1ANDREF(距前高天,1)<=REF(距前低天,1)AND(距前高
天>=4ORLLV(缺口判断,距前高天)=-1ORLLV(L,距前低天+2)<REF(LLV(L,距前低天
+1),1)),-1,0);
低保留S:=IF((低保留AA=-1OR低保留AB=-1)ANDL<REF(H,距前高天+1),-1,0);
预判:=IF((距前低天<4ANDHHV(缺口判断,距前低天)!=1)ORREF(低保留S,距前低
天)=0,1,0);
判断:=IF(局部高点预选C=1ANDREF(距前低天,1)<=REF(距前高天,1)AND预判=1AND
大值周期>REF(小值周期,距前低天+1)AND大值周期>REF(小值周期,距前低天)AND大值
周期>REF(大值周期,距前高天),1,0);
高保留A:=IF(局部高点预选C=1ANDREF(距前低天,1)>REF(距前高天,1)ANDHHV(H,距前
低天+1)>REF(HHV(H,距前低天+1),1),1,0);
高保留B:=IF(局部高点预选C=1ANDREF(距前低天,1)<=REF(距前高天,1)ANDREF(低保
留S,距前低天)=-1AND(距前低天>=4ORHHV(缺口判断,距前低天)=1),1,0);
高保留:=IF((高保留A=1OR高保留B=1OR判断=1)ANDH>REF(L,距前低天+1),1,0);
预判A:=IF((距前高天<4ANDHHV(缺口判断,距前高天)!=1)ORREF(高保留,距前高
天)=0,1,0);
判断A:=IF(局部低点预选C=-1ANDREF(距前高天,1)<=REF(距前低天,1)AND预判A=1
AND小值周期>REF(大值周期,距前高天+1)AND小值周期>REF(大值周期,距前高天)
AND小值周期>REF(小值周期,距前低天),-1,0);
低保留A:=IF(局部低点预选C=-1ANDREF(距前高天,1)>REF(距前低天,1)ANDLLV(L,距前
高天+1)<REF(LLV(L,距前高天+1),1),-1,0);
低保留B:=IF(局部低点预选C=-1ANDREF(距前高天,1)<=REF(距前低天,1)AND(距前高
天>=4ORLLV(缺口判断,距前高天)=-1OR判断A=-1),-1,0);
低保留:=IF((低保留A=-1OR低保留B=-1)ANDL<REF(H,距前高天+1),-1,0);
距前高天A:=BARSLAST(高保留=1);
距前低天A:=BARSLAST(低保留=-1);
预判X:=IF((距前低天A<4ANDHHV(缺口判断,距前低天A)!=1)ORREF(低保留,距前低天
A)=0,1,0);
判断X:=IF(局部高点预选C=1ANDREF(距前低天A,1)<=REF(距前高天A,1)AND预判X=1
AND大值周期>REF(小值周期,距前低天A+1)AND大值周期>REF(小值周期,距前低天A)
AND大值周期>REF(大值周期,距前高天A),1,0);
高保留XA:=IF(局部高点预选C=1ANDREF(距前低天A,1)>REF(距前高天A,1)AND
HHV(H,距前低天A+1)>REF(HHV(H,距前低天A+1),1),1,0);
高保留XB:=IF(局部高点预选C=1ANDREF(距前低天A,1)<=REF(距前高天A,1)AND
REF(低保留,距前低天A)=-1AND(距前低天A>=4ORHHV(缺口判断,距前低天A)=1),1,0);
高保留X:=IF((高保留XA=1OR高保留XB=1OR判断X=1)ANDH>REF(L,距前低天
A+1),1,0);
预判XA:=IF((距前高天A<4ANDHHV(缺口判断,距前高天A)!=1)ORREF(高保留XA,距前
高天A)=0,1,0);
判断XA:=IF(局部低点预选C=-1ANDREF(距前高天A,1)<=REF(距前低天A,1)AND预判
XA=1AND小值周期>REF(大值周期,距前高天A+1)AND小值周期>REF(大值周期,距前高
天A)AND小值周期>REF(小值周期,距前低天A),-1,0);
低保留XA:=IF(局部低点预选C=-1ANDREF(距前高天A,1)>REF(距前低天A,1)AND
LLV(L,距前高天A+1)<REF(LLV(L,距前高天A+1),1),-1,0);
低保留XB:=IF(局部低点预选C=-1ANDREF(距前高天A,1)<=REF(距前低天A,1)AND(距
前高天A>=4ORLLV(缺口判断,距前高天A)=-1OR判断XA=-1),-1,0);
低保留X:=IF((低保留XA=-1OR低保留XB=-1)ANDL<REF(H,距前高天A+1),-1,0);
距前高天YA:=BARSLAST(高保留X=1);
距前低天YA:=BARSLAST(低保留X=-1);
预判YX:=IF((距前低天YA<4ANDHHV(缺口判断,距前低天YA)!=1)ORREF(低保留X,距前
低天YA)=0,1,0);
判断YX:=IF(局部高点预选C=1ANDREF(距前低天YA,1)<=REF(距前高天YA,1)AND预判
YX=1AND大值周期>REF(小值周期,距前低天YA+1)AND大值周期>REF(小值周期,距前
低天YA)AND大值周期>REF(大值周期,距前高天YA),1,0);
高保留YXA:=IF(局部高点预选C=1ANDREF(距前低天YA,1)>REF(距前高天YA,1)AND
HHV(H,距前低天YA+1)>REF(HHV(H,距前低天YA+1),1),1,0);
高保留YXB:=IF(局部高点预选C=1ANDREF(距前低天YA,1)<=REF(距前高天YA,1)AND
REF(低保留X,距前低天YA)=-1AND(距前低天YA>=4ORHHV(缺口判断,距前低天
YA)=1),1,0);
高保留YX:=IF((高保留YXA=1OR高保留YXB=1OR判断YX=1)ANDH>REF(L,距前低
天YA+1),1,0);
预判YXA:=IF((距前高天YA<4ANDHHV(缺口判断,距前高天YA)!=1)ORREF(高保留YXA,
距前高天YA)=0,1,0);
判断YXA:=IF(局部低点预选C=-1ANDREF(距前高天YA,1)<=REF(距前低天YA,1)AND
预判YXA=1AND小值周期>REF(大值周期,距前高天YA+1)AND小值周期>REF(大值周
期,距前高天YA)AND小值周期>REF(小值周期,距前低天YA),-1,0);
低保留YXA:=IF(局部低点预选C=-1ANDREF(距前高天YA,1)>REF(距前低天YA,1)AND
LLV(L,距前高天YA+1)<REF(LLV(L,距前高天YA+1),1),-1,0);
低保留YXB:=IF(局部低点预选C=-1ANDREF(距前高天YA,1)<=REF(距前低天YA,1)AND
(距前高天YA>=4ORLLV(缺口判断,距前高天YA)=-1OR判断YXA=-1),-1,0);
低保留YX:=IF((低保留YXA=-1OR低保留YXB=-1)ANDL<REF(H,距前高天YA+1),-1,0);
AAAD:=IF(高保留YX=1AND低保留YX=-1ANDH>REF(H,REF(距前高天
YA,1)+2),1,IF(高保留YX=1AND低保留YX=-1ANDL<REF(L,REF(距前低天
YA,1)+2),-1,0));
极点保留:=IF(AAAD=0,高保留YX+低保留YX,AAAD);
局部极点:IF(极点保留=-1,L,IF(极点保留=1,H,DRAWNULL))CIRCLEDOT
COLORYELLOW;
DRAWLINE(极点保留=-1,局部极点,极点保留=1,局部极点,0)COLORBLUE;
DRAWLINE(极点保留=1,局部极点,极点保留=-1,局部极点,0)COLORBLUE;
DD1:=BARSLAST(ABS(极点保留)!=1);
{
DRAWICON(极点保留=-1,局部极点-0.03,1);
DRAWICON(极点保留=1,局部极点+0.03,2);
}
{
MA5:MA(CLOSE,5),COLORFF00FF,LINETHICK2;
判:IF(MA5<REF(MA5,1),MA5,DRAWNULL),COLORWHITE,LINETHICK2;
};
中枢—分笔分段
{N1:1,100,10;N2:1,100,10;DISP:=1,3,2};
N1:=10;N2:=10;DISP:=2;
K:=IF(PERIOD=5,1,{日}
IF(PERIOD=6,1,{周}
IF(PERIOD=7,1,{月}
IF(PERIOD=8,1,{多分钟}
IF(PERIOD=9,1,{多日}
IF(PERIOD=10,1,{季}
IF(PERIOD=11,2,{年}
IF(PERIOD=4,1,{60F}
IF(PERIOD=3,1,{30F}
IF(PERIOD=2,1,{15F}
IF(PERIOD=1,1{5F},1{1F})))))))))))/10;
P1:=PEAK(1,K*N1,1);
P2:=PEAK(1,K*N1,2);
WP1:=PEAKBARS(1,K*N1,1);
WP2:=PEAKBARS(1,K*N1,2);
T1:=TROUGH(2,K*N2,1);
T2:=TROUGH(2,K*N2,2);
WT1:=TROUGHBARS(2,K*N2,1);
WT2:=TROUGHBARS(2,K*N2,2);
TJ1:=P1>T1ANDP2>T2;
ZD:=MAX(T1,T2);
ZG:=MIN(P1,P2);
LL:=MIN(T1,T2);
HH:=MAX(P1,P2);
TJ2:=FILTER(ZG>ZD,2);
TJ3:=ZG=REF(ZG,BARSLAST(TJ2))ORZD=REF(ZD,BARSLAST(TJ2));
TJ4:=TJ1&&TJ2&&NOT(TJ3);
TJ5:=BETWEEN(ZD,REF(ZD,REF(BARSLAST(TJ4),1)),REF(ZG,REF(BARSLAST(TJ4),1)));
TJ6:=BETWEEN(ZG,REF(ZD,REF(BARSLAST(TJ4),1)),REF(ZG,REF(BARSLAST(TJ4),1)));
TJ7:=ZG>REF(ZG,REF(BARSLAST(TJ4),1))&&ZD<REF(ZD,REF(BARSLAST(TJ4),1));
TJ8:=TJ4&&NOT(TJ5ORTJ6ORTJ7);
ZSD:=IF(TJ8,ZD,DRAWNULL);
ZSG:=IF(TJ8,ZG,DRAWNULL);
ZSH:=IF(TJ8,HH,DRAWNULL);
ZSL:=IF(TJ8,LL,DRAWNULL);
STICKLINE(TJ8,ZSH,ZSL,0,-1),COLORMAGENTA;
STICKLINE(TJ8,ZSD,ZSG,IF(DISP=1,3,0),1),COLORMAGENTA;
DRAWTEXT(DISP=2,ZSH,'中枢'),COLORWHITE;
中枢高:PLOYLINE(DISP=2,REF(ZSD,BARSLAST(TJ8))),CIRCLEDOT,COLORLIRED;
中枢低:PLOYLINE(DISP=2,REF(ZSG,BARSLAST(TJ8))),CIRCLEDOT,COLORLIGREEN;
{中枢最高:PLOYLINE(DISP=2,REF(ZSH,BARSLAST(TJ8))),POINTDOT,COLORRED;
中枢最低:PLOYLINE(DISP=2,REF(ZSL,BARSLAST(TJ8))),POINTDOT,COLORGREEN;}
趋势高:PLOYLINE(DISP=3,ZIG(1,K*N1)),COLORLIBLUE;
趋势低:PLOYLINE(DISP=3,ZIG(2,K*N2)),COLORLIBLUE;
局部低点预选A:=BACKSET(LLV(L,5)<REF(LLV(L,4),1),4);
局部低点预选B:=BACKSET(局部低点预选A=0ANDREF(局部低点预选A,1)=1,2);
局部低点预选C:=IF(局部低点预选B=1ANDREF(局部低点预选B,1)=0,-1,0);
局部高点预选A:=BACKSET(HHV(H,5)>REF(HHV(H,4),1),4);
局部高点预选B:=BACKSET(局部高点预选A=0ANDREF(局部高点预选A,1)=1,2);
局部高点预选C:=IF(局部高点预选B=1ANDREF(局部高点预选B,1)=0,1,0);
缺口判断:=IF(L>REF(H,1),1,IF(H<REF(L,1),-1,0));
距前高天:=BARSLAST(局部高点预选C=1);
距前低天:=BARSLAST(局部低点预选C=-1);
小值周期:=LOWRANGE(L);
大值周期:=TOPRANGE(H);
低保留AA:=IF(局部低点预选C=-1ANDREF(距前高天,1)>REF(距前低天,1)ANDLLV(L,距
前高天+1)<REF(LLV(L,距前高天+1),1),-1,0);
低保留AB:=IF(局部低点预选C=-1ANDREF(距前高天,1)<=REF(距前低天,1)AND(距前高
天>=4ORLLV(缺口判断,距前高天)=-1ORLLV(L,距前低天+2)<REF(LLV(L,距前低天
+1),1)),-1,0);
低保留S:=IF((低保留AA=-1OR低保留AB=-1)ANDL<REF(H,距前高天+1),-1,0);
预判:=IF((距前低天<4ANDHHV(缺口判断,距前低天)!=1)ORREF(低保留S,距前低
天)=0,1,0);
判断:=IF(局部高点预选C=1ANDREF(距前低天,1)<=REF(距前高天,1)AND预判=1AND
大值周期>REF(小值周期,距前低天+1)AND大值周期>REF(小值周期,距前低天)AND大值
周期>REF(大值周期,距前高天),1,0);
高保留A:=IF(局部高点预选C=1ANDREF(距前低天,1)>REF(距前高天,1)ANDHHV(H,距前
低天+1)>REF(HHV(H,距前低天+1),1),1,0);
高保留B:=IF(局部高点预选C=1ANDREF(距前低天,1)<=REF(距前高天,1)ANDREF(低保
留S,距前低天)=-1AND(距前低天>=4ORHHV(缺口判断,距前低天)=1),1,0);
高保留:=IF((高保留A=1OR高保留B=1OR判断=1)ANDH>REF(L,距前低天+1),1,0);
预判A:=IF((距前高天<4ANDHHV(缺口判断,距前高天)!=1)ORREF(高保留,距前高
天)=0,1,0);
判断A:=IF(局部低点预选C=-1ANDREF(距前高天,1)<=REF(距前低天,1)AND预判A=1
AND小值周期>REF(大值周期,距前高天+1)AND小值周期>REF(大值周期,距前高天)
AND小值周期>REF(小值周期,距前低天),-1,0);
低保留A:=IF(局部低点预选C=-1ANDREF(距前高天,1)>REF(距前低天,1)ANDLLV(L,距前
高天+1)<REF(LLV(L,距前高天+1),1),-1,0);
低保留B:=IF(局部低点预选C=-1ANDREF(距前高天,1)<=REF(距前低天,1)AND(距前高
天>=4ORLLV(缺口判断,距前高天)=-1OR判断A=-1),-1,0);
低保留:=IF((低保留A=-1OR低保留B=-1)ANDL<REF(H,距前高天+1),-1,0);
距前高天A:=BARSLAST(高保留=1);
距前低天A:=BARSLAST(低保留=-1);
预判X:=IF((距前低天A<4ANDHHV(缺口判断,距前低天A)!=1)ORREF(低保留,距前低天
A)=0,1,0);
判断X:=IF(局部高点预选C=1ANDREF(距前低天A,1)<=REF(距前高天A,1)AND预判X=1
AND大值周期>REF(小值周期,距前低天A+1)AND大值周期>REF(小值周期,距前低天A)
AND大值周期>REF(大值周期,距前高天A),1,0);
高保留XA:=IF(局部高点预选C=1ANDREF(距前低天A,1)>REF(距前高天A,1)AND
HHV(H,距前低天A+1)>REF(HHV(H,距前低天A+1),1),1,0);
高保留XB:=IF(局部高点预选C=1ANDREF(距前低天A,1)<=REF(距前高天A,1)AND
REF(低保留,距前低天A)=-1AND(距前低天A>=4ORHHV(缺口判断,距前低天A)=1),1,0);
高保留X:=IF((高保留XA=1OR高保留XB=1OR判断X=1)ANDH>REF(L,距前低天
A+1),1,0);
预判XA:=IF((距前高天A<4ANDHHV(缺口判断,距前高天A)!=1)ORREF(高保留XA,距前
高天A)=0,1,0);
判断XA:=IF(局部低点预选C=-1ANDREF(距前高天A,1)<=REF(距前低天A,1)AND预判
XA=1AND小值周期>REF(大值周期,距前高天A+1)AND小值周期>REF(大值周期,距前高
天A)AND小值周期>REF(小值周期,距前低天A),-1,0);
低保留XA:=IF(局部低点预选C=-1ANDREF(距前高天A,1)>REF(距前低天A,1)AND
LLV(L,距前高天A+1)<REF(LLV(L,距前高天A+1),1),-1,0);
低保留XB:=IF(局部低点预选C=-1ANDREF(距前高天A,1)<=REF(距前低天A,1)AND(距
前高天A>=4ORLLV(缺口判断,距前高天A)=-1OR判断XA=-1),-1,0);
低保留X:=IF((低保留XA=-1OR低保留XB=-1)ANDL<REF(H,距前高天A+1),-1,0);
距前高天YA:=BARSLAST(高保留X=1);
距前低天YA:=BARSLAST(低保留X=-1);
预判YX:=IF((距前低天YA<4ANDHHV(缺口判断,距前低天YA)!=1)ORREF(低保留X,距前
低天YA)=0,1,0);
判断YX:=IF(局部高点预选C=1ANDREF(距前低天YA,1)<=REF(距前高天YA,1)AND预判
YX=1AND大值周期>REF(小值周期,距前低天YA+1)AND大值周期>REF(小值周期,距前
低天YA)AND大值周期>REF(大值周期,距前高天YA),1,0);
高保留YXA:=IF(局部高点预选C=1ANDREF(距前低天YA,1)>REF(距前高天YA,1)AND
HHV(H,距前低天YA+1)>REF(HHV(H,距前低天YA+1),1),1,0);
高保留YXB:=IF(局部高点预选C=1ANDREF(距前低天YA,1)<=REF(距前高天YA,1)AND
REF(低保留X,距前低天YA)=-1AND(距前低天YA>=4ORHHV(缺口判断,距前低天
YA)=1),1,0);
高保留YX:=IF((高保留YXA=1OR高保留YXB=1OR判断YX=1)ANDH>REF(L,距前低
天YA+1),1,0);
预判YXA:=IF((距前高天YA<4ANDHHV(缺口判断,距前高天YA)!=1)ORREF(高保留YXA,
距前高天YA)=0,1,0);
判断YXA:=IF(局部低点预选C=-1ANDREF(距前高天YA,1)<=REF(距前低天YA,1)AND
预判YXA=1AND小值周期>REF(大值周期,距前高天YA+1)AND小值周期>REF(大值周
期,距前高天YA)AND小值周期>REF(小值周期,距前低天YA),-1,0);
低保留YXA:=IF(局部低点预选C=-1ANDREF(距前高天YA,1)>REF(距前低天YA,1)AND
LLV(L,距前高天YA+1)<REF(LLV(L,距前高天YA+1),1),-1,0);
低保留YXB:=IF(局部低点预选C=-1ANDREF(距前高天YA,1)<=REF(距前低天YA,1)AND
(距前高天YA>=4ORLLV(缺口判断,距前高天YA)=-1OR判断YXA=-1),-1,0);
低保留YX:=IF((低保留YXA=-1OR低保留YXB=-1)ANDL<REF(H,距前高天YA+1),-1,0);
AAAD:=IF(高保留YX=1AND低保留YX=-1ANDH>REF(H,REF(距前高天
YA,1)+2),1,IF(高保留YX=1AND低保留YX=-1ANDL<REF(L,REF(距前低天
YA,1)+2),-1,0));
极点保留:=IF(AAAD=0,高保留YX+低保留YX,AAAD);
局部极点:IF(极点保留=-1,L,IF(极点保留=1,H,DRAWNULL))CIRCLEDOT
COLORYELLOW;
DRAWLINE(极点保留=-1,局部极点,极点保留=1,局部极点,0)COLORLIRED;
DRAWLINE(极点保留=1,局部极点,极点保留=-1,局部极点,0)COLORYELLOW;
DD1:=BARSLAST(ABS(极点保留)!=1);{
DRAWTEXT(极点保留=1,局部极点,'卖'),COLORGREEN;
DRAWTEXT(极点保留=-1,局部极点,'买'),COLORRED;}
MA5:MA(CLOSE,5),COLORFF00FF,LINETHICK2;
判:IF(MA5<REF(MA5,1),MA5,DRAWNULL),COLORWHITE,LINETHICK2;
[源码注释]通达信公式动态翻译结果
输出XG:1日前的收盘价>=2日前的收盘价*1.095 AND 开盘价>1日前的最高价*1.08
推荐阅读:缠论主图通达信指标公式源码
M5:MA(CLOSE,5),COLORWHITE;
M10:MA(CLOSE,10),COLORYELLOW;
M60:MA(CLOSE,60),COLORMAGENTA;
M年:MA(CLOSE,255),COLORCYAN;
X_1:=TDXDLL8(1,PERIOD,HIGH,LOW);
DRAWLINE(X_1=1,HIGH,X_1=(-1),LOW,0),DOTLINE,COLORYELLOW;
DRAWLINE(X_1=(-1),LOW,X_1=1,HIGH,0),DOTLINE,COLORYELLOW;
X_2:=TDXDLL8(2,0,0,0);
DRAWLINE(X_2=1,HIGH,X_2=(-1),LOW,0),COLORBLUE,LINETHICK2;
DRAWLINE(X_2=(-1),LOW,X_2=1,HIGH,0),COLORBLUE,LINETHICK2;
X_3:=CLOSE>REF(CLOSE,4);
X_4:=BARSLASTCOUNT(X_3);
X_5:=X_4=9;{好}
X_6:=ISLASTBARANDBETWEEN(X_4,5,8);
X_7:=(BACKSET(X_5>0,9)ORBACKSET(X_6>0,X_4))*X_4;
DRAWTEXT(X_7>0,HIGH*1.02,VAR2STR(X_7,0)),COLORMAGENTA;
DRAWTEXT(X_4=9,HIGH*1.02,1),COLORGREEN;
X_8:=CLOSE<REF(CLOSE,4);
X_9:=BARSLASTCOUNT(X_8);
X_10:=X_9=9;
X_11:=ISLASTBARANDBETWEEN(X_9,5,8);
X_12:=(BACKSET(X_10>0,9)ORBACKSET(X_11>0,X_9))*X_9;
DRAWTEXT(X_12>0,LOW*0.98,VAR2STR(X_12,0)),COLORGREEN;
DRAWTEXT(X_9=9,LOW*0.98,1),COLORRED;
STICKLINE(CLOSE>=OPEN,OPEN,CLOSE,3,1),COLORLIRED;
STICKLINE(CLOSE<OPEN,OPEN,CLOSE,3,1),COLORLIGREEN;
STICKLINE(CLOSE>=OPEN,HIGH,CLOSE,0,1),COLORLIRED;
STICKLINE(CLOSE>=OPEN,LOW,OPEN,0,1),COLORLIRED;
STICKLINE(CLOSE<OPEN,HIGH,OPEN,0,1),COLORLIGREEN;
STICKLINE(CLOSE<OPEN,CLOSE,LOW,0,1),COLORLIGREEN;
X_13:=NAMELIKE(2)=1ORNAMELIKE(3)=1ORNAMELIKE(4)=1ORNAMELIKE(5)=1OR
NAMELIKE(6)=1;{M}
X_14:=CLOSE/REF(CLOSE,1)>=1.0992OR(CLOSE/REF(CLOSE,1)>1.0495ANDX_13)
ANDCLOSE=HIGHANDPERIOD=5;
X_15:=REF(CLOSE,1)/CLOSE>=1.0995OR(REF(CLOSE,1)/CLOSE>1.0495ANDX_13)
ANDCLOSE=LOWANDPERIOD=5;
STICKLINE(X_14,CLOSE,OPEN,2.5,0),COLORMAGENTA;
STICKLINE(X_15,CLOSE,OPEN,2.5,0),COLORLIBLUE;
{智能版:="核心指标.VAR100#DAY";}
智能版:="指标.核心#DAY";
MA1:MA(CLOSE,M1),COLORWHITE;
MA2:MA(CLOSE,M2),COLORYELLOW;
MA3:MA(CLOSE,M3),COLORCYAN;
MA4:MA(CLOSE,M4),COLORCYAN;
日线:=IF(PERIOD=5,1,0);
CA3:=REF(C,1)*日线;
A1:=REF(HIGH,3)=HHV(HIGH,笔周期*3+1)*智能版;
B1:=FILTER(A1,3);C1:=BACKSET(B1,3+1);
D1:=FILTER(C1,3);{高点}
A2:=REF(LOW,3)=LLV(LOW,笔周期*3+1)*智能版;
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:=(D1ANDNOT(D2ANDE1>=E2))ORBARSTATUS=2ORBARSCOUNT(CLOSE)=1;
H2:=D1ANDNOT(D2ANDE1>=E2);
L1:=D2ANDNOT(D1ANDE1=E2);
X1:=REF(BARSLAST(H1),1)+1;
F1:=BACKSET(H1ANDCOUNT(L1,X1)>0,LLVBARS(IF(L1,LOW,10000),X1));
G1:=F1>REF(F1,1);
I1:=BACKSET(G1,2);
LD:=I1>REF(I1,1);{过滤后低点}
L2:=LDORBARSTATUS=2ORBARSCOUNT(CLOSE)=1;
X2:=REF(BARSLAST(L2),1)+1;
F2:=BACKSET(L2ANDCOUNT(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),COLORYELLOW,LINETHICK1;
DRAWLINE(HD,H,LD,L,0),COLORYELLOW,LINETHICK1;
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:=A3ANDB3ANDHD;
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:=A4ANDB4ANDLD;
E4:=BACKSET(D4,REF(BARSLAST(LD),1)+2);
LL:=E4>REF(E4,1);{找出全部长期低点}
H3:=HHORBARSTATUS=2ORBARSCOUNT(C)=1;{后面进行过滤,方法同前。只是不用
考虑高低点出现在同一K线}
X3:=REF(BARSLAST(H3),1)+1;
F3:=BACKSET(H3ANDCOUNT(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:=LZORBARSTATUS=2ORBARSCOUNT(C)=1;
X4:=REF(BARSLAST(L4),1)+1;
F4:=BACKSET(L4ANDCOUNT(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;
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,REF(BARSLAST(LD),1)+2);
XX:=WW>REF(WW,1);
WWQ:=BACKSET(XX,REF(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,REF(BARSLAST(HD),1)+2);
XX2:=WW2>REF(WW2,1);
WW3Q:=BACKSET(XX2,REF(BARSLAST(HD),1)+2);
XX3Q:=WW3Q>REF(WW3Q,1);
WW4Q:=BACKSET(XX3Q,REF(BARSLAST(HD),1)+2);
XX4Q:=WW4Q>REF(WW4Q,1);
上轨:DRAWLINE(XX2,H,VV2,H,1)*画趋势,COLORMAGENTA,LINETHICK1;{画趋势线}
上轨1:=DRAWLINE(XX2,H,VV2,H,1);
低一:REF(L,BARSLAST(VV)),DOTLINE,COLOR99FF66;
高一:REF(H,BARSLAST(VV2)),DOTLINE,COLOR99FF66;
低二:REF(L,BARSLAST(XX)),DOTLINE,COLORFF66FF;
高二:REF(H,BARSLAST(XX2)),DOTLINE,COLORFF66FF;
DRAWTEXT(CURRBARSCOUNT=1,低一,STRCAT('低一:',CON2STR(低一,2))),COLOR99FF66;
DRAWTEXT(CURRBARSCOUNT=1,高一,STRCAT('高一:',CON2STR(高一,2))),COLOR99FF66;
DRAWTEXT(CURRBARSCOUNT=1,低二,STRCAT('低二:',CON2STR(低二,2))),COLORFF66FF;
DRAWTEXT(CURRBARSCOUNT=1,高二,STRCAT('高二:',CON2STR(高二,2))),COLORFF66FF;
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);
近0.382对数值:POW(低一,0.382对数值)*POW(高一,0.618对数值)COLORCYAN;
DRAWTEXT(CURRBARSCOUNT=1,近0.382对数值,STRCAT('近0.382位:',CON2STR(近
0.382对数值,2))),COLORCYAN;
近半分位:POW(低一,0.5)*POW(高一,0.5),COLOR99FF66,LINETHICK2;
DRAWTEXT(CURRBARSCOUNT=1,近半分位,STRCAT('近半分位:',CON2STR(近半分
位,2))),COLORGREEN;
评论(0)