通达信大分割主图指标公式
高点:=50;
低点:=30;
之幅度:=5;
高点A:=22;
低点A:=10;
精准计数周期:=240;
低1开2收3高4:=1;
基准点前N天:=0;
PP:=550;
F1:=1;
F2:=2;
N9:=120;
KP:=BARSLAST(CURRBARSCOUNT=N9);
GDY:=CONST(IF(ISLASTBAR=1,HHV(H,KP),0));{高点}
DDS:=CONST(IF(ISLASTBAR=1,LLV(L,KP),0));{低点}
KJ:=GDY-DDS;{高低点差值=分区高度}
DRAWTEXT(CURRBARSCOUNT=N9/2-58,GDY-KJ/12,' 【风险区】--高抛避险'),COLOR555555;
DRAWTEXT(CURRBARSCOUNT=N9/2-58,GDY-KJ/3.5,' 【警示区】--逢高减仓'),COLOR555555;
DRAWTEXT(CURRBARSCOUNT=N9/2-58,GDY-KJ/2.23,' 【突破区】--主力拉升'),COLOR555555;
DRAWTEXT(CURRBARSCOUNT=N9/2-58,GDY-KJ/1.82,' 【拉升区】--强势畜锐'),COLOR555555;
DRAWTEXT(CURRBARSCOUNT=N9/2-58,DDS+KJ/3.5,' 【反弹中轨】--低买高休'),COLOR555555;
DRAWTEXT(CURRBARSCOUNT=N9/2-58,DDS+KJ/10,' 【低吸区】--大胆买入'),COLOR555555;
T1:=CONST(LLVBARS(LOW,10));
T1HIGH:=CONST(REF(HIGH,T1));
CCC:=CONST(CURRBARSCOUNT);
T2G:=CONST(BARSLAST(CURRBARSCOUNT>CCC+T1 AND HIGH>T1HIGH));
T2HIGH:=CONST(REF(HIGH,T2G));
T3:=CONST(BARSLAST(CURRBARSCOUNT>CCC+T2G AND HIGH>T2HIGH));
T3HIGH:=CONST(REF(HIGH,T3));
猎击:DRAWLINE(CURRBARSCOUNT=T3+1, T3HIGH, ISLASTBAR, T3HIGH, 1),LINETHICK2,COLOR666666;
DRAWTEXT(ISLASTBAR, T3HIGH, '---------------猎击')LINETHICK1,COLOR666666;
BIAS3:=MA((CLOSE-MA(CLOSE,27))/MA(CLOSE,27),3)*100,COLORFF00FF,LINETHICK2;
操作区:=IF(BIAS3<0,BIAS3,0),COLORRED,LINETHICK3;
观望区:=IF(BIAS3>0,BIAS3,0),COLORGREEN,LINETHICK3;
VAR2K:=TROUGHBARS(3,15,1)<10;
VAR3K:=PEAKBARS(3,15,1)<10;
VAR4K:=IF(VAR2K=1,50,0);
VAR5K:=IF(VAR3K=1,50,0);
TJ1K:=观望区<REF(观望区,1) OR 观望区-REF(观望区,1)<REF(观望区,1)-REF(观望区,2);
TJ2K:=操作区>REF(操作区,1);
顶:=IF(TJ1K AND VAR5K=50,15,0),STICK;
底:=IF(TJ2K AND VAR4K=50,10,0),STICK,LINETHICK1,COLORRED;
STICKLINE(TJ1K AND VAR5K=50,HHV(H,10),HHV(H,10)-0.001,2,1),COLORLIGREEN;
STICKLINE(TJ2K AND VAR4K=50,LLV(L,10),LLV(L,10)+0.001,2,1),COLOR000099;
VAR31:=HHVBARS(ZIG(3, 19)>REF(ZIG(3,19),1)
AND REF(ZIG(3,19), 1)<REF(ZIG(3,19), 2),0);
DRAWTEXT(VAR31=1,H*0.98,'2天'),COLORCBCBC0;
DRAWTEXT(VAR31=2,L*0.98,'3天'),COLOR008888;
DRAWTEXT(VAR31=4,H*1.03,'5天'),COLOR008888;
DRAWTEXT(VAR31=7,L*0.98,'8天'),COLOR008888;
DRAWTEXT(VAR31=12,H*1.03,'13天'),COLOR008888;
DRAWTEXT(VAR31=20,L*0.98,'21天'),COLOR008888;
DRAWTEXT(VAR31=27,H*0.95,'28天'),COLORCBCBC0;
DRAWTEXT(VAR31=31,H*0.95,'32天'),COLORCBCBC0;
DRAWTEXT(VAR31=33,H*1.03,'34天'),COLOR008888;
DRAWTEXT(VAR31=49,H*0.96,'49天'),COLORCBCBC0;
DRAWTEXT(VAR31=54,L*0.98,'55天'),COLOR008888;
DRAWTEXT(VAR31=61,H*0.96,'61天'),COLORCBCBC0;
DRAWTEXT(VAR31=88,H*1.03,'89天'),COLOR008888;
DRAWTEXT(VAR31=143,L*0.98,'144天'),COLOR008888;
DRAWTEXT(VAR31=232,H*1.03,'233天'),COLOR008888;
DRAWTEXT(VAR31=376,L*0.98,'377天'),COLOR008888;
Q_3:=CROSS(EMA(C,19),EMA(C,7));
Q_4:=CROSS(EMA(C,7),EMA(C,19));
Z1:=L=LLV(L,BARSLAST(Q_3)+1);
Z2:=LLV(L,BARSLAST(Q_3)+1);
Z3:=H=HHV(H,BARSLAST(Q_4)+1);
Z4:=HHV(H,BARSLAST(Q_4)+1);
Q_A:=DRAWLINE(Z1,Z2,Z3,Z4,0),COLORMAGENTA,LINETHICK2;
Y1:=H=HHV(H,BARSLAST(Q_4)+1);
Y2:=HHV(H,BARSLAST(Q_4)+1);
Y3:=L=LLV(L,BARSLAST(Q_3)+1);
Y4:=LLV(L,BARSLAST(Q_3)+1);
Q_B:=DRAWLINE(Y1,Y2,Y3,Y4,0),COLORCYAN,LINETHICK2;
TJ1:=IF(Q_B<REF(Q_B,1) AND Q_B=Q_A,1,0);
DRAWICON(REF(TJ1,1)=0 AND TJ1>=1 AND CCI<-40 ,L*0.995,36);
{钱袋指标}
VAR113:=HHV(HIGH,60);
VAR114:=LLV(LOW,30);
VAR115:=(CLOSE-MA(CLOSE,32))/MA(CLOSE,32)*100;
VAR116:=(VAR113+VAR114+VAR115)/3;
VAR117:=EMA(VAR116,5);
K01:=EMA(VAR117,5)*2, COLORFF00FF;
D01:=EMA(K01,5), COLORWHITE;
B01:=(DRAWICON((ZIG(3,5)>REF(ZIG(3,5),1)) AND (REF(ZIG(3,5),1)<=REF(ZIG(3,5),2))
AND (REF(ZIG(3,5),2)<=REF(ZIG(3,5),3)),L*0.98,1))*D01*2/3;
B02:=IF(TROUGHBARS(3,15,1)=1 AND HIGH>LOW+0.01,20,0);
必买:=(B01 AND B02);
DRAWICON(必买,L*0.985,38);
VAR2X:=TROUGHBARS(3,15,1)<10;
VAR3X:=PEAKBARS(3,15,1)<10;
VAR4X:=IF(VAR2X=1,50,0);
底部:=IF(VAR4X=50,10,0);
多头能量:=0;
买入:=IF(底部=10 AND REF(底部,1)=10 AND REF(底部,2)=0,50,0);
{买入延迟线:底部,LINETHICK1 ,COLOR00CCFF;}
DRAWTEXT(买入=50,L*0.996,'●'),COLORCBCBC0;
{波浪}
PL5:=IF(PERIOD>=7,ZIG(3,1),IF(PERIOD=3,ZIG(1,2),ZIG(1,2)));
{S说明: 如果周月以上的选5%转向,如果日线选3%转向,如果日线以下周期选2%转向 }
PL10:=IF(PERIOD>=7,ZIG(3,30),IF(PERIOD=3,ZIG(1,10),ZIG(1,10)));
{S说明: 如果周月以上的选10%转向,如果日线选5%转向,如果日线以下周期选4%转向 }
EN1:=PL5>REF(PL5,1) AND REF(PL5,1)<=REF(PL5,2) AND REF(PL5,2)<=REF(PL5,3);
EN2:=PL10>REF(PL10,1) AND REF(PL10,1)<=REF(PL10,2) AND REF(PL10,2)<=REF(PL10,3);
走强2:=BARSLAST(PL10<REF(PL10,1));
ZTJZ5:=IF(PL10>REF(PL10,1),COUNT(EN1,走强2),0);
DRAWTEXT(EN2 AND ZTJZ5=1,L*0.99,'●'),COLORYELLOW;
GD:=CONST(FINDHIGH(H,0,高点*10,1));
DD:=CONST(FINDLOW(L,0,低点*10,1));
GT:=CONST(BARSLAST(GD=H))+1;
DT:=CONST(BARSLAST(DD=L))+1;
SH:=CONST(IF(GT=1,H,REF(H,GT-1)));
SL:=CONST(IF(DT=1,L,REF(L,DT-1)));
CC:=IF(DT>GT,DT,GT);
CD:=INTPART(CC-(DT+GT)/2);
CG:=IF(高点>CD,CD/2,高点);
下跌周期:BARSLAST(GD=H),COLORWHITE,NODRAW;
下跌幅:IF(CURRBARSCOUNT<=GT,C/SH*100-100,DRAWNULL),NODRAW,COLORGREEN;
下跌均价:IF(CURRBARSCOUNT<=GT,SUM(AMOUNT,GT)/SUM(V,GT)/100,DRAWNULL),NODRAW,COLORLIGRAY;
跌换手%:IF(CURRBARSCOUNT<=GT,SUM(HSL.HSL,GT),DRAWNULL),COLORCYAN,NODRAW;
上涨周期:IF(CURRBARSCOUNT<=DT,BARSLAST(DD=L),DRAWNULL),COLORWHITE,NODRAW;
上涨幅:IF(CURRBARSCOUNT<=DT,C/SL*100-100,DRAWNULL),NODRAW,COLORRED;
上涨均价:IF(CURRBARSCOUNT<=DT,SUM(AMOUNT,DT)/SUM(V,DT)/100,DRAWNULL),NODRAW,COLORLIGRAY;
涨换手%:IF(CURRBARSCOUNT<=DT,SUM(HSL.HSL,DT),DRAWNULL),COLORLIMAGENTA,NODRAW;
星期:=VARCAT(VARCAT('(',IF(WEEKDAY=1,'一',IF(WEEKDAY=2,'二',IF(WEEKDAY=3,'三',IF(WEEKDAY=4,'四',IF(WEEKDAY=5,'五','')))))),')');
日期:=VARCAT('-',VARCAT(VARCAT(VARCAT(VARCAT(VARCAT(VARCAT(VAR2STR(YEAR,0),'年'),VAR2STR(MONTH,0)),'月'),VAR2STR(DAY,0)),'日'),星期));
{自动黄金分割 普通等系坐标}
DRAWRECTREL(990,1,382,1,RGB(250,250,0));
DRAWTEXT_FIX(C>0,0.382,0.00,0,'100%'),COLOR00CCCC;
DRAWRECTREL(990,188,382,188,RGB(200,200,0));
DRAWTEXT_FIX(C>0,0.382,0.189,0,'80.9% 19.1%'),COLOR00CCCC;
DRAWRECTREL(990,375,382,375,RGB(200,100,0));
DRAWTEXT_FIX(C>0,0.382,0.376,0,'61.8% 38.2%'),COLOR0099CC;
DRAWRECTREL(990,491,382,491,RGB(50,50,0));
DRAWTEXT_FIX(C>0,0.382,0.492,0,'50.0% 50.0%'),COLOR008888;
DRAWRECTREL(990,607,382,607,RGB(200,100,0));
DRAWTEXT_FIX(C>0,0.382,0.608,0,'38.2% 61.8%'),COLOR0099CC;
DRAWRECTREL(990,794,382,794,RGB(200,200,0));
DRAWTEXT_FIX(C>0,0.382,0.795,0,'19.1% 80.9%'),COLOR00CCCC;
DRAWRECTREL(990,982,382,982,RGB(250,250,0));
DRAWTEXT_FIX(C>0,0.382,0.936,0,'BASE'),COLOR00CCCC;
DRAWRECTREL(990,232,382,232,RGB(100,100,0));
DRAWRECTREL(990,144.6,382,144.6,RGB(100,100,0));
DRAWRECTREL(990,750,382,750,RGB(100,100,0));
DRAWRECTREL(990,839,382,839,RGB(100,100,0));
DRAWRECTREL(990,234,382,234,RGB(200,200,0));
DRAWTEXT_FIX(C>0,0.382,0.233,0,'76.4% 23.6%%'),COLOR00CCCC;
DRAWRECTREL(990,752,382,752,RGB(200,200,0));
DRAWTEXT_FIX(C>0,0.382,0.753,0,'23.6% 76.4%'),COLOR00CCCC;
GDA:=CONST(FINDHIGH(H,0,高点A*10,1));
DDA:=CONST(FINDLOW(L,0,低点A*10,1));
GTA:=CONST(BARSLAST(GDA=H))+1;
DTA:=CONST(BARSLAST(DDA=L))+1;
SHA:=CONST(IF(GTA=1,H,REF(H,GTA-1)));
SLA:=CONST(IF(DTA=1,L,REF(L,DTA-1)));
CCA:=IF(DTA>GTA,DTA,GTA);
CDA:=INTPART(CCA-(DTA+GTA)/2);
CGA:=IF(高点A>CDA,CDA/2,高点A);
{幅度尺}
DRAWTEXT(CURRBARSCOUNT=GTA,SHA-SHA*0.03,STRCAT('一3% ',CON2STR(SHA-SHA*0.03,2))),COLOR004500;
DRAWTEXT(CURRBARSCOUNT=GTA,SHA-SHA*0.05,STRCAT('一5% ',CON2STR(SHA-SHA*0.05,2))),COLOR004500;
DRAWTEXT(CURRBARSCOUNT=GTA,SHA-SHA*0.08,STRCAT('一8% ',CON2STR(SHA-SHA*0.08,2))),COLOR004500;
DRAWTEXT(CURRBARSCOUNT=GTA,SHA-SHA*0.1,STRCAT('一10% ',CON2STR(SHA-SHA*0.1,2))),COLOR004500;
DRAWTEXT(CURRBARSCOUNT=GTA,SHA-SHA*0.13,STRCAT('一13% ',CON2STR(SHA-SHA*0.13,2))),COLOR994400;
DRAWTEXT(CURRBARSCOUNT=GTA,SHA-SHA*0.15,STRCAT('一15% ',CON2STR(SHA-SHA*0.15,2))),COLOR004500;
DRAWTEXT(CURRBARSCOUNT=GTA,SHA-SHA*0.18,STRCAT('一18% ',CON2STR(SHA-SHA*0.18,2))),COLOR004500;
DRAWTEXT(CURRBARSCOUNT=GTA,SHA-SHA*0.2,STRCAT('一20% ',CON2STR(SHA-SHA*0.2,2))),COLOR004500;
DRAWTEXT(CURRBARSCOUNT=GTA,SHA-SHA*0.25,STRCAT('一25% ',CON2STR(SHA-SHA*0.25,2))),COLOR004500;
DRAWTEXT(CURRBARSCOUNT=GTA,SHA-SHA*0.3,STRCAT('一30% ',CON2STR(SHA-SHA*0.3,2))),COLOR004500;
DRAWTEXT(CURRBARSCOUNT=GTA,SHA-SHA*0.4,STRCAT('一40% ',CON2STR(SHA-SHA*0.4,2))),COLOR004500;
DRAWTEXT(CURRBARSCOUNT=GTA,SHA-SHA*0.5,STRCAT('一50% ',CON2STR(SHA-SHA*0.5,2))),COLOR004500;
DRAWTEXT(CURRBARSCOUNT=GTA,SHA-SHA*0.6,STRCAT('一60% ',CON2STR(SHA-SHA*0.6,2))),COLOR004500;
DRAWTEXT(CURRBARSCOUNT=GTA,SHA-SHA*0.7,STRCAT('一70% ',CON2STR(SHA-SHA*0.7,2))),COLOR004500;
DRAWTEXT(CURRBARSCOUNT=GTA,SHA-SHA*0.8,STRCAT('一80% ',CON2STR(SHA-SHA*0.8,2))),COLOR004500;
DRAWTEXT(CURRBARSCOUNT=GTA,SHA-SHA*0.9,STRCAT('一90% ',CON2STR(SHA-SHA*0.9,2))),COLOR004500;
DRAWTEXT(CURRBARSCOUNT=DTA,SLA*1.03,STRCAT('一3% ',CON2STR(SLA*1.03,2))),COLOR444444;
DRAWTEXT(CURRBARSCOUNT=DTA,SLA*1.05,STRCAT('一5% ',CON2STR(SLA*1.05,2))),COLOR444444;
DRAWTEXT(CURRBARSCOUNT=DTA,SLA*1.08,STRCAT('一8% ',CON2STR(SLA*1.08,2))),COLOR444444;
DRAWTEXT(CURRBARSCOUNT=DTA,SLA*1.1,STRCAT('一10% ',CON2STR(SLA*1.1,2))),COLOR444444;
DRAWTEXT(CURRBARSCOUNT=DTA,SLA*1.13,STRCAT('一13% ',CON2STR(SLA*1.13,2))),COLOR994400;
DRAWTEXT(CURRBARSCOUNT=DTA,SLA*1.15,STRCAT('一15% ',CON2STR(SLA*1.15,2))),COLOR444444;
DRAWTEXT(CURRBARSCOUNT=DTA,SLA*1.18,STRCAT('一18% ',CON2STR(SLA*1.18,2))),COLOR444444;
DRAWTEXT(CURRBARSCOUNT=DTA,SLA*1.2,STRCAT('一20% ',CON2STR(SLA*1.2,2))),COLOR444444;
DRAWTEXT(CURRBARSCOUNT=DTA,SLA*1.25,STRCAT('一25% ',CON2STR(SLA*1.25,2))),COLOR444444;
DRAWTEXT(CURRBARSCOUNT=DTA,SLA*1.3,STRCAT('一30% ',CON2STR(SLA*1.3,2))),COLOR444444;
DRAWTEXT(CURRBARSCOUNT=DTA,SLA*1.4,STRCAT('一40% ',CON2STR(SLA*1.4,2))),COLOR444444;
DRAWTEXT(CURRBARSCOUNT=DTA,SLA*1.5,STRCAT('一50% ',CON2STR(SLA*1.5,2))),COLOR444444;
DRAWTEXT(CURRBARSCOUNT=DTA,SLA*1.6,STRCAT('一60% ',CON2STR(SLA*1.6,2))),COLOR444444;
DRAWTEXT(CURRBARSCOUNT=DTA,SLA*1.7,STRCAT('一70% ',CON2STR(SLA*1.7,2))),COLOR444444;
DRAWTEXT(CURRBARSCOUNT=DTA,SLA*1.8,STRCAT('一80% ',CON2STR(SLA*1.8,2))),COLOR444444;
DRAWTEXT(CURRBARSCOUNT=DTA,SLA*1.9,STRCAT('一90% ',CON2STR(SLA*1.9,2))),COLOR444444;
TC1:=IF(H=HHV(H,48),H,DRAWNULL);
TC2:=CONST(BARSLAST(TC1=H))+1;
UPPER:=CONST(IF(TC2=1,H,REF(H,TC2-1)));
BC1:=IF(L=LLV(L,48),L,DRAWNULL);
BC2:=CONST(BARSLAST(BC1=L))+1;
LOWER:=CONST(IF(BC2=1,L,REF(L,BC2-1)));
LP:=CURRBARSCOUNT<=BC2 AND L=LOWER;
HP:=CURRBARSCOUNT<=TC2 AND H=UPPER;
AB1:=EMA(((2*C+H+L)/4-LLV(LOW,30))/
(HHV(HIGH,30)-LLV(LOW,30))*100,8);
BA1:=EMA(AB1,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(BC2>TC2,LP,HP)));
上沿:IF(AB1>0 AND AB1-BA1<=0 AND YXHX,上轨,上轨),DOTLINE,COLOR555555;
中枢:IF(AB1>0 AND AB1-BA1<=0 AND YXHX,中轨,中轨),DOTLINE,COLOR555555;
下沿:IF(AB1>0 AND AB1-BA1<=0 AND YXHX,下轨,下轨),DOTLINE,COLOR555555;
HIGHN:=10;
LOWN:=10;
HIGHDISPLAY:=0;
LOWDISPLAY:=0;
ZGDISPLAY:=0;
MADISPLAY:=0;
AAA:=REF(H,HIGHN)=HHV(H,2*HIGHN+1);
QY:=BACKSET(AAA,HIGHN+1);
CCCC:=FILTER(QY,HIGHN) AND H=HHV(H,HIGHN+1);
DDDF:=BARSLAST(CCCC);
GDTS:=IF(CCCC,CURRBARSCOUNT,0);
DINGBU:=IF(DDDF,REF(H,DDDF),H);{顶部}
DINGBUTS:=IF(DDDF,REF(GDTS,DDDF),GDTS);
GDCS1:=CONST(DINGBUTS);
DINGBUTS1:=REF(DINGBUTS,DDDF+1);
GDCS2:=CONST(DINGBUTS1);
DRAWLINE(CURRBARSCOUNT=GDCS2,H,ISLASTBAR,REF(H,GDCS2-1),1),COLOR996600,POINTDOT;
DRAWLINE(CURRBARSCOUNT=GDCS1,H,ISLASTBAR,REF(H,GDCS1-1),1),COLOR996600,POINTDOT;
AA1:=REF(L,LOWN)=LLV(L,2*LOWN+1);
QY1:=BACKSET(AA1,LOWN+1);
CC1D:=FILTER(QY1,LOWN) AND L=LLV(L,LOWN+1);
DD1D:=BARSLAST(CC1D);
DDTS:=IF(CC1D,CURRBARSCOUNT,0);
DDTS1:=IF(DD1D,REF(DDTS,DD1D),DDTS);
DDCS1:=CONST(DDTS1);
DDTS2:=REF(DDTS1,DD1D+1);
DDCS2:=CONST(DDTS2);
DRAWLINE(CURRBARSCOUNT=DDCS1,L,ISLASTBAR,REF(L,DDCS1-1),1),COLOR996600,POINTDOT;
DRAWLINE(CURRBARSCOUNT=DDCS2,L,ISLASTBAR,REF(L,DDCS2-1),1),COLOR996600,POINTDOT;
前20内高:=HHV(C,20);
昨前高:CONST(REF(前20内高,2)),COLORGRAY,POINTDOT;