通达信缠论背弛主图指标公式

通达信新高二选股指标公式

通达信缠论背弛主图指标公式:

SHORT:=7;LONG:=19;

MA5:MA(CLOSE,5);

MA13:MA(CLOSE,13);

MA21:MA(CLOSE,21);

MA34:MA(CLOSE,34);

MA55:MA(CLOSE,55);

MA89:MA(CLOSE,89);

MA144:MA(CLOSE,144);

MA233:MA(CLOSE,233);

T:=PERIOD;

D:=IF(T=0,30,{1F}

IF(T=1,25,{5F}

IF(T=8,25,{多分钟}

IF(T=2,20,{15F}

IF(T=3,20,{30F}

IF(T=4,20,{60F}

IF(T=5,10,{日}

IF(T=6,10,{周}

IF(T=7,10,{月}

IF(T=9,10,{多日}

IF(T=10,10{季},10{年})))))))))));

RMA:=EMA(CLOSE,SHORT),COLORLIGRAY;

NMA:=EMA(CLOSE,LONG),COLORMAGENTA;

RISK:=IF(NMA>RMA,NMA,DRAWNULL),COLORGREEN;

DRAWLINE(L=LLV(L,BArslAst(crOSS(NMA,RMA))+1) AND L=LLV(L,D) AND RMA<=NMA,L,H=HHV(H,BARSLAST(CROSS(RMA,NMA))+1) AND H=HHV(H,D) AND RMA>=NMA,H,0),COLOR0000FF,LINETHICK2;

DRAWLINE(H=HHV(H,BARSLAST(CROSS(RMA,NMA))+1) AND H=HHV(H,D) AND RMA>=NMA,H,L=LLV(L,BARSLAST(CROSS(NMA,RMA))+1) AND L=LLV(L,D) AND RMA<=NMA,L,0),COLOR238E23,LINETHICK2;

重心线:=(H+L+O+C*3)/6;

{DRAWGBKLAST(V>1,STRIP(RGB(60,10,0),RGB(10,50,0),0));}

NX:=(3*CLOSE+LOW+OPEN+HIGH)/6;

牛线:=(20*NX+19*REF(NX,1)+18*REF(NX,2)+17*REF(NX,3)+16*REF(NX,4)

+15*REF(NX,5)+14*REF(NX,6)+13*REF(NX,7)+12*REF(NX,8)+11*REF(NX,9)

+10*REF(NX,10)+9*REF(NX,11)+8*REF(NX,12)+7*REF(NX,13)+6*REF(NX,14)

+5*REF(NX,15)+4*REF(NX,16)+3*REF(NX,17)

+2*REF(NX,18)+REF(NX,20))/210;

{牛熊线:MA(牛线,6),COLORGREEN,LINETHICK2;}

牛熊线:=MA(牛线,6);{,COLORLIGREEN,LINETHICK1;}

{DRAWBAND(重心线,RGB(168,18,38),牛熊线,RGB(10,100,200));}

简底:=H>REF(H,1) AND REF(H,1)<REF(H,2) AND L>REF(L,1) AND REF(L,1)<REF(L,2);

简顶:=H<REF(H,1) AND REF(H,1)>REF(H,2) AND L<REF(L,1) AND REF(L,1)>REF(L,2);

包含1:=REF(H,1)>=REF(H,2) AND REF(L,1)<=REF(L,2);

包含2:=REF(H,1)<=REF(H,2) AND REF(L,1)>=REF(L,2);

包底1:=H>REF(H,2) AND REF(H,2)<REF(H,3) AND L>REF(L,1) AND REF(L,1)<REF(L,3);

包底2:=H>REF(H,1) AND REF(H,1)<REF(H,3) AND L>REF(L,2) AND REF(L,2)<REF(L,3);

包顶1:=H<REF(H,1) AND REF(H,1)>REF(H,3) AND L<REF(L,2) AND REF(L,2)>REF(L,3);

包顶2:=H<REF(H,2) AND REF(H,2)>REF(H,3) AND L<REF(L,1) AND REF(L,1)>REF(L,3);

复底:=IF(包含1,包底1,IF(包含2,包底2,简底));

复顶:=IF(包含1,包顶1,IF(包含2,包顶2,简顶));

底分型:=IF(BARSLAST(CROSS(牛熊线,重心线))>3,FILTER(BacKSET(FILTER(复底 AND 重心线<牛熊线,3),2),1),0);

顶分型:=IF(BARSLAST(CROSS(重心线,牛熊线))>3,FILTER(BACKSET(FILTER(复顶 AND 重心线>牛熊线,3),2),1),0);

{

DRAWICON(底分型,L,1);

DRAWICON(顶分型,H,2);

}

{******************************************************************************************}

局部低点预选A:=BACKSET(LLV(L,5)<REF(LLV(L,4),1),4);

局部低点预选B:=BACKSET(局部低点预选A=0 AND REF(局部低点预选A,1)=1,2);

局部低点预选C:=IF(局部低点预选B=1 AND REF(局部低点预选B,1)=0,-1,0);

局部高点预选A:=BACKSET(HHV(H,5)>REF(HHV(H,4),1),4);

局部高点预选B:=BACKSET(局部高点预选A=0 AND REF(局部高点预选A,1)=1,2);

局部高点预选C:=IF(局部高点预选B=1 AND REF(局部高点预选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=-1 AND REF(距前高天,1)>REF(距前低天,1) AND LLV(L,距前高天+1)<REF(LLV(L,距前高天+1),1),-1,0);

低保留AB:=IF(局部低点预选C=-1 AND REF(距前高天,1)<=REF(距前低天,1) AND (距前高天>=4 OR LLV(缺口判断,距前高天)=-1 OR LLV(L,距前低天+2)<REF(LLV(L,距前低天+1),1)),-1,0);

低保留S:=IF((低保留AA=-1 OR 低保留AB=-1) AND L<REF(H,距前高天+1),-1,0);

预判:=IF((距前低天<4 AND HHV(缺口判断,距前低天)!=1) OR REF(低保留S,距前低天)=0,1,0);

判断:=IF(局部高点预选C=1 AND REF(距前低天,1)<=REF(距前高天,1) AND 预判=1 AND 大值周期>REF(小值周期,距前低天+1) AND 大值周期>REF(小值周期,距前低天) AND 大值周期>REF(大值周期,距前高天),1,0);

高保留A:=IF(局部高点预选C=1 AND REF(距前低天,1)>REF(距前高天,1) AND HHV(H,距前低天+1)>REF(HHV(H,距前低天+1),1),1,0);

高保留B:=IF(局部高点预选C=1 AND REF(距前低天,1)<=REF(距前高天,1) AND REF(低保留S,距前低天)=-1 AND (距前低天>=4 OR HHV(缺口判断,距前低天)=1),1,0);

高保留:=IF((高保留A=1 OR 高保留B=1 OR 判断=1) AND H>REF(L,距前低天+1),1,0);

预判A:=IF((距前高天<4 AND HHV(缺口判断,距前高天)!=1) OR REF(高保留,距前高天)=0,1,0);

判断A:=IF(局部低点预选C=-1 AND REF(距前高天,1)<=REF(距前低天,1) AND 预判A=1 AND 小值周期>REF(大值周期,距前高天+1) AND 小值周期>REF(大值周期,距前高天) AND 小值周期>REF(小值周期,距前低天),-1,0);

低保留A:=IF(局部低点预选C=-1 AND REF(距前高天,1)>REF(距前低天,1) AND LLV(L,距前高天+1)<REF(LLV(L,距前高天+1),1),-1,0);

低保留B:=IF(局部低点预选C=-1 AND REF(距前高天,1)<=REF(距前低天,1) AND (距前高天>=4 OR LLV(缺口判断,距前高天)=-1 OR 判断A=-1),-1,0);

低保留:=IF((低保留A=-1 OR 低保留B=-1) AND L<REF(H,距前高天+1),-1,0);

距前高天A:=BARSLAST(高保留=1);

距前低天A:=BARSLAST(低保留=-1);

预判X:=IF((距前低天A<4 AND HHV(缺口判断,距前低天A)!=1) OR REF(低保留,距前低天A)=0,1,0);

判断X:=IF(局部高点预选C=1 AND REF(距前低天A,1)<=REF(距前高天A,1) AND 预判X=1 AND 大值周期>REF(小值周期,距前低天A+1) AND 大值周期>REF(小值周期,距前低天A) AND 大值周期>REF(大值周期,距前高天A),1,0);

高保留XA:=IF(局部高点预选C=1 AND REF(距前低天A,1)>REF(距前高天A,1) AND HHV(H,距前低天A+1)>REF(HHV(H,距前低天A+1),1),1,0);

高保留XB:=IF(局部高点预选C=1 AND REF(距前低天A,1)<=REF(距前高天A,1) AND REF(低保留,距前低天A)=-1 AND (距前低天A>=4 OR HHV(缺口判断,距前低天A)=1),1,0);

高保留X:=IF((高保留XA=1 OR 高保留XB=1 OR 判断X=1) AND H>REF(L,距前低天A+1),1,0);

预判XA:=IF((距前高天A<4 AND HHV(缺口判断,距前高天A)!=1) OR REF(高保留XA,距前高天A)=0,1,0);

判断XA:=IF(局部低点预选C=-1 AND REF(距前高天A,1)<=REF(距前低天A,1) AND 预判XA=1 AND 小值周期>REF(大值周期,距前高天A+1) AND 小值周期>REF(大值周期,距前高天A) AND 小值周期>REF(小值周期,距前低天A),-1,0);

低保留XA:=IF(局部低点预选C=-1 AND REF(距前高天A,1)>REF(距前低天A,1) AND LLV(L,距前高天A+1)<REF(LLV(L,距前高天A+1),1),-1,0);

低保留XB:=IF(局部低点预选C=-1 AND REF(距前高天A,1)<=REF(距前低天A,1) AND (距前高天A>=4 OR LLV(缺口判断,距前高天A)=-1 OR 判断XA=-1),-1,0);

低保留X:=IF((低保留XA=-1 OR 低保留XB=-1) AND L<REF(H,距前高天A+1),-1,0);

距前高天YA:=BARSLAST(高保留X=1);

距前低天YA:=BARSLAST(低保留X=-1);

预判YX:=IF((距前低天YA<4 AND HHV(缺口判断,距前低天YA)!=1) OR REF(低保留X,距前低天YA)=0,1,0);

判断YX:=IF(局部高点预选C=1 AND REF(距前低天YA,1)<=REF(距前高天YA,1) AND 预判YX=1 AND 大值周期>REF(小值周期,距前低天YA+1) AND 大值周期>REF(小值周期,距前低天YA) AND 大值周期>REF(大值周期,距前高天YA),1,0);

高保留YXA:=IF(局部高点预选C=1 AND REF(距前低天YA,1)>REF(距前高天YA,1) AND HHV(H,距前低天YA+1)>REF(HHV(H,距前低天YA+1),1),1,0);

高保留YXB:=IF(局部高点预选C=1 AND REF(距前低天YA,1)<=REF(距前高天YA,1) AND REF(低保留X,距前低天YA)=-1 AND (距前低天YA>=4 OR HHV(缺口判断,距前低天YA)=1),1,0);

高保留YX:=IF((高保留YXA=1 OR 高保留YXB=1 OR 判断YX=1) AND H>REF(L,距前低天YA+1),1,0);

预判YXA:=IF((距前高天YA<4 AND HHV(缺口判断,距前高天YA)!=1) OR REF(高保留YXA,距前高天YA)=0,1,0);

判断YXA:=IF(局部低点预选C=-1 AND REF(距前高天YA,1)<=REF(距前低天YA,1) AND 预判YXA=1 AND 小值周期>REF(大值周期,距前高天YA+1) AND 小值周期>REF(大值周期,距前高天YA) AND 小值周期>REF(小值周期,距前低天YA),-1,0);

低保留YXA:=IF(局部低点预选C=-1 AND REF(距前高天YA,1)>REF(距前低天YA,1) AND LLV(L,距前高天YA+1)<REF(LLV(L,距前高天YA+1),1),-1,0);

低保留YXB:=IF(局部低点预选C=-1 AND REF(距前高天YA,1)<=REF(距前低天YA,1) AND (距前高天YA>=4 OR LLV(缺口判断,距前高天YA)=-1 OR 判断YXA=-1),-1,0);

低保留YX:=IF((低保留YXA=-1 OR 低保留YXB=-1) AND L<REF(H,距前高天YA+1),-1,0);

AAAD:=IF(高保留YX=1 AND 低保留YX=-1 AND H>REF(H,REF(距前高天YA,1)+2),1,IF(高保留YX=1 AND 低保留YX=-1 AND L<REF(L,REF(距前低天YA,1)+2),-1,0));

极点保留:=IF(AAAD=0,高保留YX+低保留YX,AAAD);

{局部极点:IF(极点保留=-1,L,IF(极点保留=1,H,DRAWNULL)) CIRCLEDOT COLORYELLOW;}

DRAWICON(极点保留=-1,L*0.96,7);

DRAWICON(极点保留=1,H*1.04,8);

{

DRAWICON(极点保留=-1,CLOSE,7);

DRAWICON(极点保留=1,OPEN,8);

}

DRAWICON(极点保留=-1,LOW,1);

DRAWICON(极点保留=1,HIGH,2);

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

DEA:=EMA(DIFF,8);

A1:=BARSLAST(REF(CROSS(DIFF,DEA),1));

B1:=REF(C,A1+1)>C AND REF(DIFF,A1+1)<DIFF AND CROSS(DIFF,DEA);

DRAWTEXT(IF(B1>0,1,0),L-0.1,'macd底背'),COLORGREEN;

RSV:=(CLOSE-LLV(LOW,9))/(HHV(HIGH,9)-LLV(LOW,9))*100;

K:=SMA(RSV,3,1);

A2:=BARSLAST(REF(CROSS(K,D),1));

B2:=REF(C,A2+1)>C AND REF(K,A2+1)<K AND CROSS(K,D);

DRAWTEXT(IF(B2>0,1,0),L-0.25,'kdj底背'),COLORYELLOW;

LC:=REF(CLOSE,1);

rsi1:=SMA(MAX(CLOSE-LC,0),6,1)/SMA(Abs(CLOSE-LC),6,1)*100;

RSI2:=SMA(MAX(CLOSE-LC,0),12,1)/SMA(ABS(CLOSE-LC),12,1)*100;

A3:=BARSLAST(REF(CROSS(RSI1,RSI2),1));

B3:=REF(C,A3+1)>C AND REF(RSI1,A3+1)<RSI1 AND CROSS(RSI1,RSI2);

DRAWTEXT(IF(B3>0,1,0),L-0.4,'RSI底背');

C1:=BARSLAST(REF(CROSS(DEA,DIFF),1));

D1:=REF(C,C1+1)<C AND REF(DIFF,C1+1)>DIFF AND CROSS(DEA,DIFF);

DRAWTEXT(IF(D1>0,1,0),H+0.1,'MACD顶背'),COLORWHITE;

C2:=BARSLAST(REF(CROSS(D,K),1));

D2:=REF(C,C2+1)<C AND REF(K,C2+1)>K AND CROSS(D,K);

DRAWTEXT(IF(D2>0,1,0),H+0.25,'kdJ顶背'),COLORWHITE;

C3:=BARSLAST(REF(CROSS(RSI2,RSI1),1));

D3:=REF(C,C3+1)<C AND REF(RSI1,C3+1)>RSI1 AND CROSS(RSI2,RSI1);

DRAWTEXT(IF(D3>0,1,0),H+0.4,'RSI顶背');

TMP1:=IF(C>MA5,1,0);

TMP2:=IF(C>MA13,1,0);

TMP3:=IF(C>MA21,1,0);

TMP4:=IF(C>MA34,1,0);

TMP5:=IF(C>MA55,1,0);

TMP6:=IF(C>MA89,1,0);

TMP7:=IF(C>MA144,1,0);

TMP8:=IF(C>MA233,1,0);

类别:TMP1+TMP2+TMP3+TMP4+TMP5+TMP6+TMP7+TMP8+1,NODRAW;

{DRAWNUMBER(1,H,类别);};

通达信量价图指标公式