通达信区间箱体主图指标公式
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;{高低点差值=分区高度}
AQ1:=REF(V,1);AQ2:=DVOL;AQ3:=AQ2/AQ1;
LNX:=AQ3-REF(AQ3,1);
E1:=REF(C,1);E2:=DCLOSE;E3:=(E2-E1)/E1*100;
QMX:=E3-REF(E3,1);
XGG:=CROSS(LNX,500) AND CROSS(QMX,10);
DRAWTEXT(XGG=1,L*0.97,'◇'),COLORCBCBC0;
{钱袋指标}
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;
J01:=K01*3-D01*2, COLORYELLOW;
ENTERLONG:=CROSS(K01,D01);
EXITLONG:=CROSS(D01,K01);
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.98,38);
抄底:=ABS((CROSS("MACD.DIF","MACD.DEA") && "MACD.DEA"<=-0.07)*"MACD.DIF")*1.09,COLORLIMAGENTA,LINETHICK2;
DRAWTEXT(ABS(抄底)>0,L*0.996,'●'),COLOR000099;
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);
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;
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,上轨,上轨),DOTLINE,COLOR666666;
中枢:IF(AB1S>0 AND AB1S-BA1S<=0 AND YXHX,中轨,中轨),DOTLINE,COLOR666666;
下沿:IF(AB1S>0 AND AB1S-BA1S<=0 AND YXHX,下轨,下轨),DOTLINE,COLOR666666;
CURR:=CURRBARSCOUNT;
TCH:=CONST(FINDHIGH(H,0,133,1));
GTT:=CONST(BARSLAST(TCH=H))+1;
SX跌H:=CONST(IF(GTT=1,H,REF(H,GTT-1)));
BCL:=CONST(FINDLOW(L,0,21,1));
DTT:=CONST(BARSLAST(BCL=L))+1;
SX涨L:=CONST(IF(DTT=1,L,REF(L,DTT-1)));
涨点:=BARSSINCE(BACKSET(ISLASTBAR,BARSLAST(L=SX涨L)+1));
跌点:=BARSSINCE(BACKSET(ISLASTBAR,BARSLAST(H=SX跌H)+1));
IM68:=((SX跌H-SX涨L)/8-(SX跌H-SX涨L)/8);
GH跌X:=SX跌H+(SX跌H-SX涨L)/8; DL涨X:=SX涨L-(SX跌H-SX涨L)/8;
GTHT:=IF(DTT>GTT,DTT,GTT); R:=ABS(GTT-DTT);
DRAWBAND(IF(CURR<=GTHT,SX跌H,DRAWNULL),RGB(0,120,120),SX跌H,RGB(8,168,168));
DRAWBAND(IF(CURR<=GTHT,SX涨L,DRAWNULL),RGB(0,120,120),SX涨L,RGB(0,160,160));
STICKLINE(CURRBARSCOUNT=GTT,SX跌H,SX涨L,0,0),COLOR556600;
STICKLINE(CURRBARSCOUNT=DTT,SX跌H,SX涨L,0,0),COLOR666666;
STICKLINE(CURRBARSCOUNT=1,SX跌H,SX涨L,0,0),COLOR556600;
DRAWKLINE(H,O,L,C);