通达信指标公式源码 自用收口布林主图指标.docx
《通达信指标公式源码 自用收口布林主图指标.docx》由会员分享,可在线阅读,更多相关《通达信指标公式源码 自用收口布林主图指标.docx(12页珍藏版)》请在冰豆网上搜索。
![通达信指标公式源码 自用收口布林主图指标.docx](https://file1.bdocx.com/fileroot1/2022-12/12/17a0b78b-a7c9-4216-b6c2-0fd75bdb9851/17a0b78b-a7c9-4216-b6c2-0fd75bdb98511.gif)
通达信指标公式源码自用收口布林主图指标
{蓝灰底}
买线:
=EMA(C,2);
卖线:
=EMA(SLOPE(C,21)*20+C,42);
STICKLINE(买线>=卖线,HHV(H,60),LLV(L,60),5,0),COLOR000045;
STICKLINE(买线<卖线,HHV(H,60),LLV(L,60),5,0),COLOR004500;
HHH:
=(20*H+19*REF(H,1)+18*REF(H,2)+17*REF(H,3)+16*REF(H,4)+15*REF(H,5)+14*REF(H,6)
+13*REF(H,7)+12*REF(H,8)+11*REF(H,9)+10*REF(H,10)+9*REF(H,11)+8*REF(H,12)
+7*REF(H,13)+6*REF(H,14)+5*REF(H,15)+4*REF(H,16)+3*REF(H,17)+2*REF(H,18)+
REF(H,20))/210,COLORBLUE,LINETHICK1;
LLY:
=(20*L+19*REF(L,1)+18*REF(L,2)+17*REF(L,3)+16*REF(L,4)+15*REF(L,5)+14*REF(L,6)
+13*REF(L,7)+12*REF(L,8)+11*REF(L,9)+10*REF(L,10)+9*REF(L,11)+8*REF(L,12)
+7*REF(L,13)+6*REF(L,14)+5*REF(L,15)+4*REF(L,16)+3*REF(L,17)+2*REF(L,18)+
REF(L,20))/210,COLORBLUE,LINETHICK1;
D90H:
=EMA(HHH,90),COLORRED,LINETHICK1;
D90L:
=EMA(LLY,90),COLORRED,LINETHICK1;
DGH:
=(20*H+19*REF(H,1)+18*REF(H,2)+17*REF(H,3)+16*REF(H,4)+15*REF(H,5)+14*REF(H,6)
+13*REF(H,7)+12*REF(H,8)+11*REF(H,9)+10*REF(H,10)+9*REF(H,11)+8*REF(H,12)
+7*REF(H,13)+6*REF(H,14)+5*REF(H,15)+4*REF(H,16)+3*REF(H,17)+2*REF(H,18)+
REF(H,20))/210,COLORBLUE,LINETHICK1;DDL:
=(20*L+19*REF(L,1)+18*REF(L,2)+17*REF(L,3)+16*REF(L,4)+15*REF(L,5)+14*REF(L,6)
+13*REF(L,7)+12*REF(L,8)+11*REF(L,9)+10*REF(L,10)+9*REF(L,11)+8*REF(L,12)
+7*REF(L,13)+6*REF(L,14)+5*REF(L,15)+4*REF(L,16)+3*REF(L,17)+2*REF(L,18)+
REF(L,20))/210,COLORBLUE,LINETHICK1;D90C:
=D90H-D90L;D90D:
=D90H+D90C*2,COLORRED,LINETHICK1;D90T:
=D90L-D90C*2,COLORRED,LINETHICK1;G0:
=(XMA(XMA(H,25),25)-XMA(XMA(L,25),25))*1+XMA(XMA(H,25),25),LINETHICK1,COLORWHITE;D0:
=XMA(XMA(L,25),25)-(XMA(XMA(H,25),25)-XMA(XMA(L,25),25))*1,LINETHICK1,COLORWHITE;DTD:
=D0>=D90TANDG0>=D90D;KTD:
=G0<=D90DANDD0<=D90T;ZDD:
=D0>=D90TANDG0<=D90D;BDD0:
=(XMA(XMA(H,60),60)-XMA(XMA(L,60),60))*3+XMA(XMA(H,60),60),LINETHICK2,COLORGREEN;BDT0:
=XMA(XMA(L,60),60)-(XMA(XMA(H,60),60)-XMA(XMA(L,60),60))*3,LINETHICK2,COLORGREEN;STICKLINE(DTD=1,G0,D0,5,0),COLOR000066;STICKLINE(KTD=1,G0,D0,5,0),COLOR003300;STICKLINE(ZDD=1,G0,D0,5,0),COLOR555555;
ZK1:
(XMA(XMA(H,25),25)-XMA(XMA(L,25),25))*1+XMA(XMA(H,25),25),COLORAAAAAA,NODRAW;
ZD1:
XMA(XMA(L,25),25)-(XMA(XMA(H,25),25)-XMA(XMA(L,25),25))*1,COLORAAAAAA,NODRAW;
白色点多定位1:
=LZD1;
白色点空定位1:
=H>ZK1ANDLSTICKLINE(白色点多定位1=1,L,ZD1,3,0),COLORWHITE;
STICKLINE(白色点空定位1=1,H,ZK1,3,0),COLORWHITE;
白色点多定位2:
=H白色点空定位2:
=L>ZK1;
STICKLINE(白色点多定位2=1,L,H,0.0,0),COLORWHITE;
STICKLINE(白色点多定位2=1,C,O,3,0),COLORWHITE;
STICKLINE(白色点空定位2=1,L,H,0.0,0),COLORWHITE;
STICKLINE(白色点空定位2=1,C,O,3,0),COLORWHITE;
多头多定位:
=CROSS(ZD1,L)ANDDTD=1;
多头平定位:
=CROSS(H,ZK1)ANDDTD=1ANDZDD=0;
空头空定位:
=CROSS(H,ZK1)ANDKTD=1;
空头平定位:
=CROSS(ZD1,L)ANDKTD=1ANDZDD=0;
震荡多定位:
=CROSS(ZD1,L)ANDZDD=1;
震荡空定位:
=CROSS(H,ZK1)ANDZDD=1;
DRAWICON(空头平定位=1,L,3);
DRAWICON(多头平定位=1,H,4);
DRAWICON(多头多定位=1OR震荡多定位=1,L,3);
DRAWICON(空头空定位=1OR震荡空定位=1,H,4);
MID8:
=(3*CLOSE+LOW+OPEN+HIGH)/6;
判断1线:
(20*MID8+19*REF(MID8,1)+18*REF(MID8,2)+17*REF(MID8,3)+16*REF(MID8,4)+15*REF(MID8,5)+14*REF(MID8,6)+13*REF(MID8,7)+12*REF(MID8,8)+11*REF(MID8,9)+10*REF(MID8,10)+9*REF(MID8,11)+8*REF(MID8,12)+7*REF(MID8,13)+6*REF(MID8,14)+5*REF(MID8,15)+4*REF(MID8,16)+3*REF(MID8,17)+2*REF(MID8,18)+REF(MID8,20))/210,COLORYELLOW;
判断2线:
MA(判断1线,6);
DRAWBAND(判断1线,RGB(255,0,0),判断2线,RGB(0,180,0));
N9:
=120;
KP:
=BARSLAST(CURRBARSCOUNT=N9);
GD:
=CONST(IF(ISLASTBAR=1,HHV(H,KP),0));{高点}
DDS:
=CONST(IF(ISLASTBAR=1,LLV(L,KP),0));{低点}
KJ:
=GD-DDS;{高低点差值=分区高度}
DRAWTEXT(CURRBARSCOUNT=N9/2-58,GD-KJ/12,'【风险区】--高抛避险'),COLOR555555;
DRAWTEXT(CURRBARSCOUNT=N9/2-58,GD-KJ/3.5,'【警示区】--逢高减仓'),COLOR555555;
DRAWTEXT(CURRBARSCOUNT=N9/2-58,GD-KJ/2.23,'【突破区】--主力拉升'),COLOR555555;
DRAWTEXT(CURRBARSCOUNT=N9/2-58,GD-KJ/1.82,'【拉升区】--强势畜锐'),COLOR555555;
DRAWTEXT(CURRBARSCOUNT=N9/2-58,DDS+KJ/3.5,'【反弹中轨】--低买高休'),COLOR555555;
DRAWTEXT(CURRBARSCOUNT=N9/2-58,DDS+KJ/10,'【低吸区】--大胆买入'),COLOR555555;
{大波段操作公式源码}
VAR3F:
=(2*CLOSE+HIGH+LOW)/4;
VAR4F:
=LLV(LOW,34);
VAR5S:
=HHV(HIGH,34);
DIFF:
EMA((VAR3F-VAR4F)/(VAR5S-VAR4F)*100,13),NODRAW;
DEAF:
EMA(0.667*REF(DIFF,1)+0.333*DIFF,2),NODRAW;
DRAWTEXT(CROSS(DIFF,DEAF)ANDDIFF<22,DDS+KJ/15,'谷'),COLOR006600;
DRAWTEXT(CROSS(DIFF,30)ANDDEAFDRAWTEXT(CROSS(DIFF,65)ANDDEAFDRAWTEXT(CROSS(DIFF,75)ANDDEAFDRAWTEXT(CROSS(DEAF,DIFF)ANDDEAF>75,GD-KJ/4.5,'峰'),COLOR006600;
AAA7:
=STRCAT('换手率:
',CON2STR(DYNAINFO(37)*100,2));
AAA8:
=STRCAT('成交金额:
',CON2STR(DYNAINFO(7)/100000000,2)),'(%)';
DRAWTEXT_FIX(1,0.868,0.01,0,AAA7),COLORYELLOW;
DRAWTEXT_FIX(1,0.928,0.01,0,AAA8),COLORYELLOW;
AAF:
=ABS((2*CLOSE+HIGH+LOW)/4-MA(CLOSE,30))/MA(CLOSE,30);
长期趋势线:
=DMA((2*CLOSE+LOW+HIGH)/4,AAF);
CCF:
=(CLOSE/长期趋势线);
MA1F:
=MA(CCF*(2*CLOSE+HIGH+LOW)/4,3);
MAAA:
=((MA1F-长期趋势线)/长期趋势线)/3;
TMP:
=MA1F-MAAA*MA1F;
长期趋势上升:
IF(TMP>长期趋势线,长期趋势线,DRAWNULL),LINETHICK2,COLOR880066;
DRAWKLINE(HIGH,OPEN,LOW,CLOSE);
{N=0100030}
{主图}
T1U:
=FINDLOWBARS(L,0,NM,1);
T5:
=BARSLAST(CURRBARSCOUNT=CONST(T1U)+1);
D1D:
REF(L,T5),COLOR00AA00,LINETHICK1;
T1:
=CONST(LLVBARS(LOW,10));
T1HIGH:
=CONST(REF(HIGH,T1));
CCC:
=CONST(CURRBARSCOUNT);
T2G:
=CONST(BARSLAST(CURRBARSCOUNT>CCC+T1ANDHIGH>T1HIGH));
T2HIGH:
=CONST(REF(HIGH,T2G));
T3:
=CONST(BARSLAST(CURRBARSCOUNT>CCC+T2GANDHIGH>T2HIGH));
T3HIGH:
=CONST(REF(HIGH,T3));
猎击:
DRAWLINE(CURRBARSCOUNT=T3+1,T3HIGH,ISLASTBAR,T3HIGH,1),LINETHICK2,COLOR555555;
DRAWTEXT(ISLASTBAR,T3HIGH,'---------------猎击')LINETHICK1,COLOR555555;
半分位:
=(O+C)/2;
昨半分位:
=REF(半分位,1);
STICKLINE(ISLASTBAR,昨半分位,昨半分位,10,0)COLORAAAA00;
H分:
=(H+L)/2;
昨H分:
=REF(H分,1);
STICKLINE(ISLASTBAR,昨H分,昨H分,10,0)COLOR996600;
前20内高:
=HHV(C,20);
昨前高:
CONST(REF(前20内高,2)),COLORAAAAAA,POINTDOT;
JLH:
=REF(V,3)>=MA(V,3)*0.8;
BP:
=L>REF(O,3)*1.01ANDREF(L,1)>REF(O,3)*1.01ANDREF(L,2)>=REF(O,3)*1.01;
BJ:
=REF(C,3)>REF(C,4)ANDREF(C,3)>REF(O,3);
AB:
=BJANDJLHANDBP;
TH:
=BARSLAST(AB);
LLL:
=IF(TH=1ORTH=2ORTH=3,L,9999);
LTH:
=BARSLAST(LLL=LLV(LLL,TH));
VAR1L:
=CONST(LTH)<100ANDLTH>0;
VAR2L:
=CONST(REF(L,LTH))=CONST(L);
XGH:
=VAR1LANDVAR2LANDISLASTBAR;
DRAWICON(XGH,L*0.98,1);
DRAWLINE(CURRBARSCOUNT=CONST(LTH)+1,L,ISLASTBAR,REF(L,LTH),0),COLOR00CCCC,DOTLINE;
N1E:
=10;N2E:
=10;DISP:
=2;
KV:
=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,KV*N1E,1);
P2:
=PEAK(1,KV*N1E,2);
WP1:
=PEAKBARS(1,KV*N1E,1);
WP2:
=PEAKBARS(1,KV*N1E,2);
T1E:
=TROUGH(2,KV*N2E,1);
T2G1:
=TROUGH(2,KV*N2E,2);
WT1:
=TROUGHBARS(2,KV*N2E,1);
WT2:
=TROUGHBARS(2,KV*N2E,2);
TJ1:
=P1>T1EANDP2>T2G1;
ZD:
=MAX(T1E,T2G1);
ZG:
=MIN(P1,P2);
LL:
=MIN(T1E,T2G1);
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))&&ZDTJ8:
=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=3,ZIG(1,KV*N1E)),COLORLIBLUE;
趋势低:
PLOYLINE(DISP=3,ZIG(2,KV*N2E)),COLORLIBLUE;
局部低点预选A:
=BACKSET(LLV(L,5)局部低点预选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距前高天:
=BARSLAST(局部高点预选C=1);
距前低天:
=BARSLAST(局部低点预选C=-1);
小值周期:
=LOWRANGE(L);
大值周期:
=TOPRANGE(H);
低保留AA:
=IF(局部低点预选C=-1ANDREF(距前高天,1)>REF(距前低天,1)ANDLLV(L,距前高天+1)低保留AB:
=IF(局部低点预选C=-1ANDREF(距前高天,1)<=REF(距前低天,1)AND(距前高天>=4ORLLV(缺口判断,距前高天)=-1ORLLV(L,距前低天+2)低保留S:
=IF((低保留AA=-1OR低保留AB=-1)ANDL预判:
=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)低保留B:
=IF(局部低点预选C=-1ANDREF(距前高天,1)<=REF(距前低天,1)AND(距前高天>=4ORLLV(缺口判断,距前高天)=-1OR判断A=-1),-1,0);
低保留:
=IF((低保留A=-1OR低保留B=-1)ANDL距前高天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=1AND小值周期>REF(大值周期,距前高天A+1)AND小值周期>REF(大值周期,距前高天A)AND小值周期>REF(小值周期,距前低天A),-1,0);
低保留XA:
=IF(局部低点预选C=-1ANDREF(距前高天A,1)>REF(距前低天A,1)ANDLLV(L,距前高天A+1)低保留XB:
=IF(局