通达信布林量能平台指标公式通达信公式
周期:=40;
盘1:=CONST(LLV(INDEXL,周期)); 盘差:=CONST(HHV(INDEXH,周期))-盘1;
价1:=CONST(LLV(L,周期)); 价差:=CONST(HHV(H,周期))-价1;
价盘比:= 价差/盘差;
{大盘: 价1+(INDEXC-盘1)*价盘比,COLORAA0077;}
CX:=价1+(INDEXC-盘1)*价盘比;
HX:=价1+(INDEXH-盘1)*价盘比;
LX:=价1+(INDEXL-盘1)*价盘比;
OX:=价1+(INDEXO-盘1)*价盘比;
STICKLINE(OX<=CX,HX,LX,0,0),COLOR660066;
STICKLINE(OX<=CX,OX,CX,1,1),COLOR660066;
STICKLINE(OX>=CX,HX,LX,0,0),COLOR8A0000;
STICKLINE(OX>=CX,OX,CX,1,1),COLOR8A0000;
{重绘K线}
DRAWKLINE(HIGH,OPEN,LOW,CLOSE);
{以上代码加到你主图代码的前面}
{以下是你的主图原码}
{比如:布林线信号}
H_L:=价差;
BOLL:MA(C,20),COLORYELLOW;
UPPER:BOLL+2*STD(C,20),COLORYELLOW;
LOWER:BOLL-2*STD(C,20),COLORYELLOW;
DRAWTEXT(CROSS(C,LOWER),L-H_L*0.1,' 买'),COLORRED;
DRAWICON(CROSS(C,LOWER),L-H_L*0.1,5);{买信号B};
DRAWTEXT(CROSS(UPPER,C),H+H_L*0.1,' 卖'),COLORGREEN;
DRAWICON(CROSS(UPPER,C),H+H_L*0.1,6);{卖信号S};
EMA13:=EMA(C,13),COLORWHITE;
EMA21:=EMA(C,21),COLORYELLOW;
EMA34:=EMA(C,34),COLORFF00FF;
EMA60:=MA(C,60),COLORFFCC66;
EMA90:=MA(C,90),COLORGREEN;
EMA120:=MA(C,120),COLORRED;
EMA240:=MA(C,240),COLORBLUE;
VAR2:=(2*CLOSE+HIGH+LOW)/4;
VAR3:=IF(YEAR>=2099 AND MONTH>2,0,1);
VAR4:=LLV(LOW,5); VAR5:=HHV(HIGH,4);
散户:=EMA((VAR2-VAR4)/(VAR5-VAR4)*100,4)*VAR3;
庄家:=EMA(0.667*REF(散户,1)+0.333*散户,2)*VAR3;
DRAWTEXT(CROSS(散户,庄家) AND 散户<22,L-0.05,'←买进'),COLORLIRED;
DRAWTEXT(CROSS(庄家,散户) AND 散户>78,H+0.05,'←卖出'),COLORGREEN;
DRAWICON(CROSS(散户,庄家) AND 散户<22,L-0.05,3);
DRAWICON(CROSS(庄家,散户) AND 散户>78,H+0.05,4);
VAR9:=CLOSE-REF(CLOSE,5);
VARA:=EMA(EMA(VAR9,5),5)/EMA(EMA(ABS(VAR9),5),5);
VARC:=EMA(EMA(VAR9,20),20)/EMA(EMA(ABS(VAR9),20),20);
卖出:=IF(VARA>0 AND CROSS(VARC,VARA),90,100);
DRAWICON(卖出<0,H+0.05,0); 买线:=EMA(CLOSE,2);
卖线:=EMA(SLOPE(CLOSE,21)*20+CLOSE,42);
B1:IF(CROSS(买线,卖线),L-0.02,DRAWNULL),CROSSDOT,LINETHICK3,COLORMAGENTA;
S1:IF(CROSS(80,RSI)*30,H+0.02,DRAWNULL),CROSSDOT,LINETHICK5,COLORGREEN;
VC:=((CLOSE-MA(CLOSE,6))/MA(CLOSE,6)*100+(CLOSE-MA(CLOSE,24))/MA(CLOSE,24)*100+(CLOSE-MA (CLOSE,32))/MA(CLOSE,32)*100)/3;
S2:=IF(VC>20 AND FILTER(VC< REF(VC,1),5),H+0.02,DRAWNULL),CIRCLEDOT,LINETHICK8,COLORGREEN;
A0:=(L+H+C*2)/4;
A1:EMA(A0,14)COLORBLUE,LINETHICK1;
A2:=EMA(A0,25)COLORLIBLUE,LINETHICK1;
A1X:=(A1-REF(A1,1))/REF(A1,1)*100,NODRAW;
A2X:=(A2-REF(A2,1))/REF(A2,1)*100,NODRAW;
看多:IF(A1X>=0 AND BARSLAST(CROSS(A1X,0))>0,REF((C+O)/2,BARSLAST(CROSS(A1X,0))),DRAWNULL),LINETHICK4,COLORMAGENTA{,LINETHICK2};
逃顶:IF(A1X<0 AND BARSLAST(CROSS(0,A1X))>0,REF((C+O)/2,BARSLAST(CROSS(0,A1X))),DRAWNULL),LINETHICK6,COLORGREEN,{LINETHICK2};
买入持股:IF(A1X>=0,A1,DRAWNULL)COLORRED,LINETHICK2;
卖出空仓:IF(A1X<0 AND A2X<0,A1,DRAWNULL)COLORGREEN,LINETHICK2;
{红色的量能平台}
STICKLINE(CROSS(A1X,0),H,L,0,0 ),COLOR9933FF;
STICKLINE(CROSS(A1X,0),C,O,3,0 ),COLORRED;
STICKLINE(CROSS(A1X,0),C,O,1,0 ),COLOR0033FF;
{黄色的量能平台}
STICKLINE(CROSS(0,A1X),L,H,0,0 ),COLOR66FF99;
STICKLINE(CROSS(0,A1X),C,O,3,0 ),COLOR66FF99;
STICKLINE(CROSS(0,A1X),C,O,1,0 ),COLOR66FF99;