通达信缠论主神主图指标公式

[复制链接]
查看74 | 回复0 | 2021-8-20 20:08:48 | 显示全部楼层 |阅读模式

布林:=1;
均线:=1;
三K线:=1;
峰谷:=1;
M1:=5;
M2:=10;
M3:=20;
W00:=COST(1);
W10:=COST(10);
W20:=COST(20);
W30:=COST(30);
W40:=COST(40);
W50:=COST(50);
W60:=COST(60);
W70:=COST(70);
W80:=COST(80);
W90:=COST(90);
W100:=COST(99);
W5:=COST(5);
W15:=COST(15);
W25:=COST(25);
W35:=COST(35);
W45:=COST(45);
W55:=COST(55);
W65:=COST(65);
W75:=COST(75);
W85:=COST(85);
W95:=COST(95);
C5:=W5-W00;
C10:=W10-W5;
C15:=W15-W10;
C20:=W20-W15;
C25:=W25-W20;
C30:=W30-W25;
C35:=W35-W30;
C40:=W40-W35;
C45:=W45-W40;
C50:=W50-W45;
C55:=W55-W50;
C60:=W60-W55;
C65:=W65-W60;
C70:=W70-W65;
C75:=W75-W70;
C80:=W80-W75;
C85:=W85-W80;
C90:=W90-W85;
C95:=W95-W90;
C100:=W100-W95;
X1:=MIN(C60,MIN(C65,MIN(C70,MIN(C75,MIN(C80,MIN(C85,MIN(C90,MIN(C95,C100))))))));
ZX:=MIN(C5,MIN(C10,MIN(C15,MIN(C20,MIN(C25,MIN(C30,MIN(C35,MIN(C40,MIN(C45,MIN(C50,MIN(C55,X1)))))))))));
STICKLINE(ZX=C5,(W00+W5)/2,(W00+W5)/2,10,0),COLOR555500;
STICKLINE(ZX=C10,(W10+W5)/2,(W10+W5)/2,10,0),COLOR555500;
STICKLINE(ZX=C15,(W10+W15)/2,(W10+W15)/2,10,0),COLOR555500;
STICKLINE(ZX=C20,(W20+W15)/2,(W20+W15)/2,10,0),COLOR555500;
STICKLINE(ZX=C25,(W20+W25)/2,(W20+W25)/2,10,0),COLOR555500;
STICKLINE(ZX=C30,(W30+W25)/2,(W30+W25)/2,10,0),COLOR555500;
STICKLINE(ZX=C35,(W30+W35)/2,(W30+W35)/2,10,0),COLOR555500;
STICKLINE(ZX=C40,(W40+W35)/2,(W40+W35)/2,10,0),COLOR555500;
STICKLINE(ZX=C45,(W40+W45)/2,(W40+W45)/2,10,0),COLOR555500;
STICKLINE(ZX=C50,(W50+W45)/2,(W50+W45)/2,10,0),COLOR555500;
STICKLINE(ZX=C55,(W50+W55)/2,(W50+W55)/2,10,0),COLOR555500;
STICKLINE(ZX=C60,(W60+W55)/2,(W60+W55)/2,10,0),COLOR555500;
STICKLINE(ZX=C65,(W60+W65)/2,(W60+W65)/2,10,0),COLOR555500;
STICKLINE(ZX=C70,(W70+W65)/2,(W70+W65)/2,10,0),COLOR555500;
STICKLINE(ZX=C75,(W70+W75)/2,(W70+W75)/2,10,0),COLOR555500;
STICKLINE(ZX=C80,(W80+W75)/2,(W80+W75)/2,10,0),COLOR555500;
STICKLINE(ZX=C85,(W80+W85)/2,(W80+W85)/2,10,0),COLOR555500;
STICKLINE(ZX=C90,(W90+W85)/2,(W90+W85)/2,10,0),COLOR555500;
STICKLINE(ZX=C95,(W90+W95)/2,(W90+W95)/2,10,0),COLOR555500;
STICKLINE(ZX=C100,(W100+W95)/2,(W100+W95)/2,10,0),COLOR555500;
筹宽:=W100-W00;
JZD:=(COST(85)-COST(15))/(COST(85)+COST(15))*100;
JJ90:=W90-W70;
JJ80:=W80-W60;
JJ70:=W70-W50;
JJ60:=W60-W40;
JJ50:=W50-W30;
JJ40:=W40-W20;
JJ30:=W30-W10;
STICKLINE(JJ90/筹宽<0.08 AND JZD<8,(W90+W70)/2,(W70+W90)/2,10,0),COLORFF00FF;
STICKLINE(JJ80/筹宽<0.08 AND JZD<8,(W80+W60)/2,(W80+W60)/2,10,0),COLORFF00FF;
STICKLINE(JJ70/筹宽<0.08 AND JZD<8,(W70+W50)/2,(W70+W50)/2,10,0),COLORFF00FF;
STICKLINE(JJ60/筹宽<0.08 AND JZD<8,(W40+W60)/2,(W60+W40)/2,10,0),COLORFF00FF;
STICKLINE(JJ50/筹宽<0.08 AND JZD<8,(W50+W30)/2,(W50+W30)/2,10,0),COLORFF00FF;
STICKLINE(JJ40/筹宽<0.08 AND JZD<8,(W40+W20)/2,(W40+W20)/2,10,0),COLORFF00FF;
STICKLINE(JJ30/筹宽<0.08 AND JZD<8,(W30+W10)/2,(W10+W30)/2,10,0),COLORFF00FF;
{箱体}
TC1S:=IF(H=HHV(H,48),H,DRAWNULL);
TC2S:=CONST(BARSLAST(TC1S=H))+1;
UPPERS:=CONST(IF(TC2S=1,H,REF(H,TC2S-1)));
BC1S:=IF(L=LLV(L,48),L,DRAWNULL);
BC2S:=CONST(BARSLAST(BC1S=L))+1;
LOWERS:=CONST(IF(BC2S=1,L,REF(L,BC2S-1)));
LPS:=CURRBARSCOUNT<=BC2S AND L=LOWERS;
HPS:=CURRBARSCOUNT<=TC2S AND H=UPPERS;
AB1S:=EMA(((2*C+H+L)/4-LLV(LOW,30))/
(HHV(HIGH,30)-LLV(LOW,30))*100,8);
BA1S:=EMA(AB1S,5);
上轨:=REFDATE(REF(HHV(MAX(C,O),96),5),DATE);
下轨:=REFDATE(REF(LLV(MIN(C,O),96),5),DATE);
中轨:=((上轨)+(下轨))/2;
YXHX:=DATE>=REF(DATE,BARSLAST(IF(BC2S>TC2S,LPS,HPS)));
上沿:IF(AB1S>0 AND AB1S-BA1S<=0 AND YXHX,上轨,上轨),COLOR555555,LINETHICK2;
中枢:IF(AB1S>0 AND AB1S-BA1S<=0 AND YXHX,中轨,中轨),COLOR555555,LINETHICK2;
下沿:IF(AB1S>0 AND AB1S-BA1S<=0 AND YXHX,下轨,下轨),COLOR555555,LINETHICK2;
{三K线}
DG:=MAX(MAX(REFX(L,1),REFX(L,2)),REFX(L,3));
GD:=MIN(MIN(REFX(H,1),REFX(H,2)),REFX(H,3));
AA11:=(DG+GD)/2;
A11:=AA11>REFX(L,3) AND REFX(L,2)< AA11 AND REFX(L,1) <AA11 ;
A21:=FILTER(A11,BARSLAST(A11)+2);
A41:=A11 AND A21;
A51:=IF(REF(A41,1),H,0),NODRAW;
STICKLINE(三K线=1 && REF(A41,2),REF(GD,2),REF(DG,2),13,-1),COLORMAGENTA;
DRAWKLINE(H,O,L,C);
{峰谷}
PA:=10;
PB:=REF(HIGH,PA)=HHV(HIGH,2*PA+1);
PC:=FILTER(PB,PA);
PD:=BACKSET(PC,PA+1);
PE:=FILTER(PD,PA);{高点}
峰线:(REF(HIGH,BARSLAST(PE)))*峰谷,COLORRED,POINTDOT,LINETHICK2;
AA21:=REF(LOW,PA)=LLV(LOW,2*PA+1);
BB21:=FILTER(AA21,PA);
CC21:=BACKSET(BB21,PA+1);
DD21:=FILTER(CC21,PA);{低点}
谷线:(REF(LOW,BARSLAST(DD21)))*峰谷,COLORGREEN,POINTDOT,LINETHICK2;
{三角形中枢}
时间:=4;
A:=H=HHV(H,时间*5) AND HHV(H,时间*5)>REF(HHV(H,时间*5),1);
B:=L=LLV(L,时间*5) AND LLV(L,时间*5)<REF(LLV(L,时间*5),1);
CCA:DRAWLINE(A,H,B,L,0),COLORGREEN,LINETHICK2;
CCB:DRAWLINE(B,L,A,H,0),COLORRED,LINETHICK2;
N:=(0,1,1);
{缠论高低点}
局部低点预选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,COLORLIMAGENTA;
C1:DRAWLINE(极点保留=-1,局部极点,极点保留=1,局部极点,0),COLORMAGENTA;
C2:DRAWLINE(极点保留=1,局部极点,极点保留=-1,局部极点,0),COLORWHITE;
DRAWTEXT(极点保留=1,局部极点,'卖'),COLORGREEN;
DRAWTEXT(极点保留=-1,局部极点,'买'),LINETHICK2,COLORRED;
{均线}
MA1:EMA(C,M1),COLORRED;
MA2:EMA(C,M2),COLORYELLOW;
MA3:EMA(C,M3),COLORBLUE;
HHJSJDA:=(3*CLOSE+OPEN+LOW+HIGH)/6;
HHJSJDB:(20*HHJSJDA+19*REF(HHJSJDA,1)+18*REF(HHJSJDA,2)+17*REF(HHJSJDA,3)+16*REF(HHJSJDA,4)+15*REF(HHJSJDA,5)+14*REF(HHJSJDA,6)
+13*REF(HHJSJDA,7)+12*REF(HHJSJDA,8)+11*REF(HHJSJDA,9)+10*REF(HHJSJDA,10)+9*REF(HHJSJDA,11)+8*REF(HHJSJDA,12)
+7*REF(HHJSJDA,13)+6*REF(HHJSJDA,14)+5*REF(HHJSJDA,15)+4*REF(HHJSJDA,16)+3*REF(HHJSJDA,17)+2*REF(HHJSJDA,18)+
REF(HHJSJDA,20))/210,LINETHICK2,COLORYELLOW;
HHJSJDC:MA(HHJSJDB,5),LINETHICK2,COLORRED;
AA:=MA(CLOSE, 250);
BB:=C>=REF(O AND C,1);
MID:=(3*CLOSE+LOW+OPEN+HIGH)/6;
牛线:(20*MID+19*REF(MID,1)+18*REF(MID,2)+17*REF(MID,3)+16*REF(MID,4)+15*REF(MID,5)+14*REF(MID,6)+13*REF(MID,7)+12*REF(MID,8)+11*REF(MID,9)+10*REF(MID,10)+9*REF(MID,11)+8*REF(MID,12)+7*REF(MID,13)+6*REF(MID,14)+5*REF(MID,15)+4*REF(MID,16)+3*REF(MID,17)+2*REF(MID,18)+REF(MID,20))/210,COLORRED;
DRAWICON(CROSS(C,牛线) AND C/O>1.04 AND C/O<1.07 AND C>=AA AND BB,L,3);

202108201228.jpg

202108201228.jpg

 

回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则