通达信RSI利乖离KDJMACD指标公式
通达信RSI利乖离KDJMACD指标公式:理想论坛卧龙先生2009作品,全网最牛的通达信8个综合指标:RSI+获利率+乖离24+KDJ+MACD+A股温度+换10+大盘监控,8个不同坐标的指标融合于一身。
{8个综合指标: RSI利乖离KDJ}
利:IF(WINNER(CLOSE),WINNER(CLOSE)*100,20),COLOR0000FF,COLORFFCC00,COLORE67010,NODRAW;
LC:=REF(CLOSE,1);
RSI:SMA(MAX(CLOSE-LC,0),6,1)/SMA(ABS(CLOSE-LC),6,1)*100,COLORCC3299,NODRAW;
乖离4:=(CLOSE-MA(CLOSE,4))/MA(CLOSE,4)*100,COLORYELLOW,NODRAW;
乖离6:=(CLOSE-MA(CLOSE,6))/MA(CLOSE,6)*100,COLORYELLOW,NODRAW;
乖离8:=(CLOSE-MA(CLOSE,8))/MA(CLOSE,8)*100,COLORYELLOW,NODRAW;
乖离12:=(CLOSE-MA(CLOSE,12))/MA(CLOSE,12)*100,COLORYELLOW,NODRAW;
乖离24:(CLOSE-MA(CLOSE,24))/MA(CLOSE,24)*100,COLORYELLOW,NODRAW;
乖离:=IF(乖离24=DRAWNULL,乖离12,IF(乖离12=DRAWNULL,乖离8,IF(乖离8=DRAWNULL,乖离6,
IF(乖离6=DRAWNULL,乖离4,乖离24)))),COLORYELLOW,NODRAW;
{画蓝色背景}
DRAWBAND(50,RGB(0,0,100),RSI,RGB(0,0,0));
{KDJ: 参数9、3、3}
RSV:=(CLOSE-LLV(LOW,9))/(HHV(HIGH,9)-LLV(LOW,9))*100;
K:=SMA(RSV,3,1),COLORWHITE;
D:=SMA(K,3,1),COLORYELLOW;
J:=3*K-2*D,COLORMAGENTA,NODRAW;
DIF:=(EMA(C,12)-EMA(C,26))*100,NODRAW;
DEA:=EMA(DIF,9),NODRAW;
MACD:(DIF-DEA)*2,COLORMAGENTA,NODRAW;
LGD:=MAX(DIF,DEA);
MACDB:=IF(CURRBARSCOUNT<=100,CONST(IF(ISLASTBAR=1,
HHV(LGD,BARSLAST(CURRBARSCOUNT=100)),1)),DRAWNULL);
DIFA:=IF(MACDB>500,DIF/10,IF(MACDB>100 AND MACDB<200,DIF/2,DIF/5));
DEAA:=IF(MACDB>500,DEA/10,IF(MACDB>100 AND MACDB<200,DEA/2,DEA/5));
MACDA:=IF(FINANCE(2)=27,(DIFA-DEAA)/10,(DIFA-DEAA)*2),COLORMAGENTA,NODRAW;
{画KJ彩带线}
DRAWBAND(J,RGB(139,0,0),D,RGB(0,100,0));
RSI1:=SMA(MAX(CLOSE-LC,0),6,1)/SMA(ABS(CLOSE-LC),6,1)*100;
RSI2:=SMA(MAX(CLOSE-LC,0),12,1)/SMA(ABS(CLOSE-LC),12,1)*100;
A3:=BARSLAST(REF(CROSS(RSI1,RSI2),1));
B3:=REF(C,A3+1)>C AND REF(RSI1,A3+1)
量比:IF(ISLASTBAR,DYNAINFO(17),V/REF(MA(V,5),1)),COLORCYAN,NODRAW;
开%:(O-REF(C,1))/REF(C,1)*100,COLOR6699FF,NODRAW;
高%:(H-REF(C,1))/REF(C,1)*100,COLORMAGENTA,NODRAW;
低%:(L-REF(C,1))/REF(C,1)*100,COLORFFCC00,NODRAW;
换10:SUM(VOL/CAPITAL*100,10),COLORYELLOW,NODRAW;
总涨家:="999999$ADVANCE"+"399001$ADVANCE"; 总跌家:="999999$DECLINE"+"399001$DECLINE";
A股温度:总涨家/(总涨家+总跌家)*100,COLORGREEN,DOTLINE;
乖离低距今:BARSLAST(乖离24=LLV(乖离24,10)),COLORYELLOW,NODRAW;
利低距今:BARSLAST(利=LLV(利,10)),COLOR0000FF,NODRAW;
RSI低距今:BARSLAST(RSI=LLV(RSI,10)),COLORCC3299,NODRAW;
乖离A:=IF(乖离>0,乖离*2,IF(乖离<0,乖离*2,乖离)),COLORYELLOW;
STICKLINE(C>O,0,RSI,3,1),COLORRED;
STICKLINE(C<=O,0,RSI,3,1),COLORGREEN,COLOR008800;
STICKLINE(C>O,0,利,1.2,0),COLOR0000FF,COLOR000088;
STICKLINE(C<=O,0,利,1.2,0),COLOR004000,COLORLICYAN;
{乖离柱状图}
STICKLINE(MACDA,0,MACDA,1.6,0),COLORFF7700;{0轴线下MACD天蓝};
STICKLINE(乖离>0,0,乖离A,0.6,0),COLOR000088,COLORCC3299;
STICKLINE(乖离<0,0,乖离A,0.8.0,0),COLOR004000,COLORBLUE;
{重画线段}
B:RSI,COLORLIGRAY,COLORGREEN,COLORLIGREEN;
A1:利,COLOR0000FF,COLORE67010;
AB:乖离A,COLORYELLOW,COLOR6699FF,DOTLINE;
A股温度,COLORGREEN,DOTLINE;
{重画KDJ线}
K,COLORWHITE; D,COLORYELLOW; J,COLORMAGENTA,LINETHICK2; J,COLORWHITE,DOTLINE;
DD:=IF(CURRBARSCOUNT<=200,CONST(IF(ISLASTBAR=1,
HHV(换10,BARSLAST(CURRBARSCOUNT=120)),1)),DRAWNULL),COLORBROWN,DOTLINE;
DDB:=100/DD,COLOR0000FF,NODRAW;
换10_:IF(DDB>0,换10*DDB,IF(DDB>3,换10*DDB*0.6,IF(DDB<0,换10/DDB,DRAWNULL))),COLORYELLOW;
换10_,COLORFF6600,LINETHICK2; 换10_,COLORWHITE;
{显示文字}
DRAWTEXT(ISLASTBAR=1,乖离A,' 乖离24'),COLORYELLOW,COLOR6699FF;
DRAWTEXT(ISLASTBAR=1,利,' 利'),COLOR0000FF,COLORE67010;
DRAWTEXT(ISLASTBAR=1,RSI,' RSI'),COLORCC3299;
DRAWTEXT(ISLASTBAR=1,J,' KDJ'),COLORMAGENTA;
DRAWTEXT(ISLASTBAR=1,A股温度,'A股温度'),COLORGREEN;
DRAWTEXT(ISLASTBAR=1,MACDA,' MACD'),COLORFFCC00;
{DRAWTEXT(ISLASTBAR=1,换10_,' 换10'),COLORYELLOW;}
DRAWTEXT(ISLASTBAR,换10_,STRCAT(STRCAT(VAR2STR(换10,0),''),'换10')),COLORYELLOW;
{左上角不同颜色分别提示字符串: 沪指高开红色/低开绿色}
沪指开%:=("999999$O"-REF("999999$C",1))/REF("999999$C",1)*100,NODRAW;
DRAWTEXT_FIX(ISLASTBAR AND 沪指开%<0,0,0,0,'★今沪指低开,市场做空氛围较重'),COLORGREEN;
DRAWTEXT_FIX(ISLASTBAR AND 沪指开%>0,0,0,0,'★今沪指高开,市场做多情绪较大'),COLORRED;
沪涨%:=("999999$C"-REF("999999$C",1))/REF("999999$C",1)*100,COLORMAGENTA,NODRAW;
深涨%:=("399001$C"-REF("399001$C",1))/REF("399001$C",1)*100,COLORWHITE,NODRAW;
本市大盘涨%:IF(CODELIKE('6'),沪涨%,深涨%),COLORWHITE,NODRAW;
字符串DP:=STRCAT(STRCAT(' ☆本市大盘涨%:',VAR2STR(本市大盘涨%,2)),'%');
DRAWTEXT_FIX(ISLASTBAR,0.2,0,0,字符串DP),,COLORYELLOW;
{左下角显示:所属行业、所属概念}
DRAWTEXT_FIX(C>0,0,1,0, STRCAT('行业:',HYBLOCK)),COLORYELLOW;
DRAWTEXT_FIX(C>0,0.09,1,0,STRCAT('概念:',GNBLOCK)),COLORCYAN;
通达信RSI利乖离KDJMACD指标公式实例图解
通达信RSI利乖离KDJMACD指标公式