通达信MACD\KDJ在主图源码指标公式
{MACD+KDJ在主图显示}
{以下显示叠加指针的数值}
K:"KDJ.K",NODRAW,COLORWHITE;
D:"KDJ.D",NODRAW,COLORYELLOW;
R1:"RSI.RSI1",NODRAW,COLORC080FF;
R2:"RSI.RSI2",NODRAW,COLORFF8080;
R3:"RSI.RSI3",NODRAW,COLOR87F8F4;
F:"MACD.DIF",NODRAW,COLOR72C072;
A:"MACD.DEA",NODRAW,COLORE98210;
M:"MACD.MACD",NODRAW,COLORWHITE;
{MACD+KDJ在主图显示}
{以下计算叠加比和叠加平移量}
{1、叠加字段高度}
Q:=130;
KH:=HHV(H,Q);
KL:=LLV(L,Q);
DH:=HHV(MAX(K,D),Q);
DL:=LLV(MIN(K,D),Q);
MH:=HHV(MAX(F,A),Q);
ML:=LLV(MAX(F,A),Q);
RH:=HHV(MAX(MAX(R1,R2),R3),Q);
RL:=LLV(MIN(MIN(R1,R2),R3),Q);
{2、叠加比}
BD:=(KH-KL)/(DH-DL)/3;
BM:=(KH-KL)/(MH-ML)/3;
BR:=(KH-KL)/(RH-RL)/3;
{3、叠加平移量}
WK:=(KH-KL)/3;
WD:=(KH+KL-(DH+DL)*BD)/2-CONST(WK);
WM:=(KH+KL-(MH+ML)*BM)/2;
WR:=(KH+KL-(RH+RL)*BR)/2+CONST(WK);
{以下画叠加线}
PLOYLINE(1,K*CONST(BD)+CONST(WD)),COLORWHITE;
PLOYLINE(1,D*CONST(BD)+CONST(WD))COLORYELLOW;
{PLOYLINE(1,R1*CONST(BR)+CONST(WR)),COLORC080FF;
PLOYLINE(1,R2*CONST(BR)+CONST(WR)),COLORFF8080;
PLOYLINE(1,R3*CONST(BR)+CONST(WR)),COLOR87F8F4;}
PLOYLINE(1,F*CONST(BM)+CONST(WM)),COLOR72C072;
PLOYLINE(1,A*CONST(BM)+CONST(WM)),COLORE98210;
STICKLINE(M>0,M*CONST(BM)+CONST(WM),CONST(WM),0,-1),COLORMAGENTA;
STICKLINE(M<0,M*CONST(BM)+CONST(WM),CONST(WM),0,-1),COLORGREEN;
{以下画叠加指针的横坐标线}
PLOYLINE(1,CONST(WM)),COLORWHITE;
{PLOYLINE(1,20*CONST(BR)+CONST(WR)),COLORGREEN,POINTDOT;
PLOYLINE(1,80*CONST(BR)+CONST(WR)),COLORRED,POINTDOT;
PLOYLINE(1,50*CONST(BR)+CONST(WR)),COLORYELLOW,POINTDOT;}
PLOYLINE(1,20*CONST(BD)+CONST(WD)),COLORGREEN,POINTDOT;
PLOYLINE(1,80*CONST(BD)+CONST(WD)),COLORRED,POINTDOT;
PLOYLINE(1,50*CONST(BD)+CONST(WD)),COLORYELLOW,POINTDOT;
{以下显示叠加指针的横坐标值}
{DRAWTEXT(CURRBARSCOUNT=1,(80*CONST(BR)+CONST(WR))*1.015,'80')COLORWHITE;
DRAWTEXT(CURRBARSCOUNT=1,(80*CONST(BR)+CONST(WR))*0.99,'RSI')COLORWHITE;
DRAWTEXT(CURRBARSCOUNT=1,(50*CONST(BR)+CONST(WR))*1.015,'50')COLORWHITE;
DRAWTEXT(CURRBARSCOUNT=1,(50*CONST(BR)+CONST(WR))*0.99,'RSI')COLORWHITE;
DRAWTEXT(CURRBARSCOUNT=1,(20*CONST(BR)+CONST(WR))*1.015,'20')COLORWHITE;}
DRAWTEXT(CURRBARSCOUNT=1,(20*CONST(BD)+CONST(WD))*1.015,'20')COLORWHITE;
DRAWTEXT(CURRBARSCOUNT=1,(20*CONST(BD)+CONST(WD))*0.99,'KDJ')COLORWHITE;
DRAWTEXT(CURRBARSCOUNT=1,(50*CONST(BD)+CONST(WD))*1.015,'50')COLORWHITE;
DRAWTEXT(CURRBARSCOUNT=1,(50*CONST(BD)+CONST(WD))*0.99,'KDJ')COLORWHITE;
DRAWTEXT(CURRBARSCOUNT=1,(80*CONST(BD)+CONST(WD))*1.015,'80')COLORWHITE;
DRAWTEXT(CURRBARSCOUNT=1,(80*CONST(BD)+CONST(WD))*0.99,'KDJ')COLORWHITE;
DRAWTEXT(CURRBARSCOUNT=1,CONST(WM)*1.015,'0')COLORWHITE;
DRAWTEXT(CURRBARSCOUNT=1,CONST(WM)*0.99,'MACD')COLORWHITE;
{A:=BACKSET(ISLASTBAR,BARSLAST(CROSS(K,D))+1);};
- 上一篇公式:通达信量创新高公式升级版 抓牛不是问题
- 下一篇公式:通达信简单明了的ddx成交量源码副图