{顶0:=bbi+3*STD(BBI,13),COLOR004AFF;
底0:=BBI-3*STD(BBI,13),COLOR67FF00;
DRAWBAND(BBI,RGB(50,50,70),顶0,RGB(50,50,70));
DRAWBAND(BBI,RGB(30,35,50),底0,RGB(0,55,0));
中:BBI,COLOR006600;}
{A5:DRAWLINE(HIGH>=HHV(HIGH,5),HIGH,LOW<=LLV(LOW,5),LOW,0)COLORGRAY;
B5:DRAWLINE(LOW<=LLV(LOW,5),LOW,HIGH>=HHV(HIGH,5),HIGH,0)COLORGRAY;
A13:DRAWLINE(HIGH>=HHV(HIGH,13),HIGH,LOW<=LLV(LOW,13),LOW,0),COLORFF9088;
B13:DRAWLINE(LOW<=LLV(LOW,13),LOW,HIGH>=HHV(HIGH,13),HIGH,0)COLORFF9088;
A34:DRAWLINE(HIGH>=HHV(HIGH,34),HIGH,LOW<=LLV(LOW,34),LOW,0),COLORCYAN,DOTLINE;
B34:DRAWLINE(LOW<=LLV(LOW,34),LOW,HIGH>=HHV(HIGH,34),HIGH,0),COLORLIBLUE,DOTLINE;
A55:DRAWLINE(HIGH>=HHV(HIGH,55),HIGH,LOW<=LLV(LOW,55),LOW,0)COLOR3FC98B,DOTLINE;
B55:DRAWLINE(LOW<=LLV(LOW,55),LOW,HIGH>=HHV(HIGH,55),HIGH,0),COLOR09EEDD,DOTLINE;}
{双k线的9种排列及代号的数学原理-残月08制作于2011.12.04};
{8种底分型和8种顶分型的数学原理-残月08制作于2011.12.04};
MA1K高:=IF(H>REF(H,1),1,IF(H=REF(H,1),0,IF(H<REF(H,1),-1,0)));
MA1K低:=IF(L>REF(L,1),1,IF(L=REF(L,1),0,IF(L<REF(L,1),-1,0)));
MA1K:=MA1K高+MA1K低;MA1K昨:=REF(MA1K,1);
{底转强:=IF(MA1K=2 AND MA1K昨<2,10,0);
顶转弱:=IF(MA1K=-2 AND MA1K昨>-2,10,0);
底:=IF(底转强=10 AND REF(底转强,1)=0,10,0);
顶:=IF(顶转弱=10 AND REF(顶转弱,1)=0,10,0);}
{顶底分型}
STICKLINE(1,H,L,1.5,0),COLORLIBLUE;
{STICKLINE(底=10,H,L,1.5,0),COLORRED;
STICKLINE(顶=10,H,L,1.5,0),COLOR0CEEC0;}
上:STICKLINE(MA1K=2,H,L,2,0)COLORRED;
下:STICKLINE(MA1K=-2,H,L,2,0)COLORCYAN;
平包:STICKLINE(MA1K=0,H,L,2,0)COLORWHITE;
平上:STICKLINE(MA1K=1,H,L,2,1)COLORLIRED;
平下:STICKLINE(MA1K=-1,H,L,2,1)COLORLIBLUE;
包含上:STICKLINE(RANGE(MA1K,-2,2) AND H>=REF(H,2),HHV(H,2),HHV(L,2),1,0)COLORBLUE;
包含下:STICKLINE(RANGE(MA1K,-2,2) AND H<REF(H,2),LLV(L,2),LLV(H,2),1,0)COLORBLUE;
{通达信顶底分型线段主图指标公式股票软件源码如下:}
局部低点预选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 },POINTDOT,LINETHICK6,COLORYELLOW;
{DRAWLINE(极点保留=-1,局部极点,极点保留=1,局部极点,0)COLORFF9088;
DRAWLINE(极点保留=1,局部极点,极点保留=-1,局部极点,0)COLORFF9088;}
{DRAWICON(极点保留=-1,L-0.03,1);};
强弱:MA(C,7)COLORDDDDDD;
{波峰谷}
BDGD:=crOSS(0.8,H=HHV(H,4));
GDSJ:=BARSLAST(BDGD)+1;
波峰:=REF(H,GDSJ),COLOR00FF00,POINTDOT;
BDDD:=CROSS(0.8,L=LLV(L,4));
DDSJ:=BARSLAST(BDDD)+1;
波谷:=REF(L,DDSJ),COLORFF00FF,POINTDOT;
STICKLINE(GDSJ<=4,波峰,波峰,2,0),COLORGREEN,LINETHICK01;
STICKLINE(DDSJ<=4,波谷,波谷,2,0),COLOR20FFCC,LINETHICK01;
通达信分型缠论主图指标公式
本文来自网络,不代表公式指标立场,转载请注明出处:https://www.gszb.top/95308.html