在线检测未来函数

大智慧RSI核心指标公式

来源:Internet,编辑:股旁网,2012-11-27

input:n(10,1,30),p(9,1,21);
0,DOTLINE,colorwhite;
50,DOTLINE,colorwhite;
-20,DOTLINE,color000099;
-50,DOTLINE,colorwhite;
{rsi差比}
gc:=close;
比c:=ema(gc/"SH000001$CLOSE"*1000,3);
比LC:= REF(比c,1);
RSI1:=SMA(MAX(比c-比LC,0),6,1)/SMA(ABS(比c-比LC),6,1)*100;
比RSI:=eMA(比RSI1,n)-50;
比RSEA:=EMA(比RSI,p);
STICKLINE(比RSI<ref(比RSI,1)and 比RSI>0,0,比RSI,6,0),color777777;
STICKLINE(比RSI<ref(比RSI,1)and 比RSI<0,0,比RSI,6,0),color555555;
STICKLINE(比RSI>ref(比RSI,1)and 比RSI<0,0,比RSI,6,0),COLOR777777;
STICKLINE(比RSI>ref(比RSI,1)and 比RSI>0,0,比RSI,6,0),COLOR999999;
{个股多空}
TR := SUM(MAX(MAX(HIGH-LOW,ABS(HIGH-REF(CLOSE,1))),ABS(LOW-REF(CLOSE,1))),14);
HD := HIGH-REF(HIGH,1);
LD := REF(LOW,1)-LOW;
DMP:= SUM(IF(HD>0 AND HD>LD,HD,0),14);
DMM:= SUM(IF(LD>0 AND LD>HD,LD,0),14);
多:=DMP*100/TR-50;
空:=DMM*100/TR-50;
差值:多-空,linethick0,color00cc33;
STICKLINE( 差值>=0,-50 ,差值-50,4 ,0 ),COLORCC0099;
STICKLINE( 差值<0,-50 ,差值-50,4 ,0 ),COLOR336666;
{RSI}
LC := REF(CLOSE,1);
RSI1:SMA(MAX(CLOSE-LC,0),6,1)/SMA(ABS(CLOSE-LC),6,1)*100-100,LAYER0;
RSI2:SMA(MAX(CLOSE-LC,0),12,1)/SMA(ABS(CLOSE-LC),12,1)*100-100,LAYER0;
RSI3:SMA(MAX(CLOSE-LC,0),24,1)/SMA(ABS(CLOSE-LC),24,1)*100-100,LAYER0;
{RSI压力支撑}
TY:=RSI1;
AA:=REF(TY,5)=HHV(TY,2*5+1);
BB:=BACKSET(AA,5+1);
CC:=FILTER(BB,5) AND TY=HHV(TY,5+1);
AA2:=REF(TY,5)=LLV(TY,2*5+1);
BB2:=BACKSET(AA2,5+1);
CC2:=FILTER(BB2,5) AND TY=LLV(TY,5+1);
GG:=BARSTATUS=2 AND REF(CC,BARSLAST(CC));
HH:=BACKSET(GG,BARSLAST(CC)+1);
II:=HH>REF(HH,1);
JJ:=REF(BARSLAST(CC),1);
KK:=BACKSET(II,JJ+2);
LL:=KK>REF(KK,1);
DRAWLINE(LL,TY,II,TY,1),COLORblue,DOTLINE;
CS:=(REF(TY,BARSLAST(II))-REF(TY,BARSLAST(LL)))/(BARSLAST(LL)-BARSLAST(II));
阻力线:=REF(TY,BARSLAST(II))+BARSLAST(II)*CS;
阻力值:阻力线,LINETHICK0;
DRAWICON(CROSS(TY,阻力线),阻力线*0.99,12);
阻力点:阻力线*0.99,linethick0;
GG2:=BARSTATUS=2 AND REF(CC2,BARSLAST(CC2));
HH2:=BACKSET(GG2,BARSLAST(CC2)+1);
II2:=HH2>REF(HH2,1);
JJ2:=REF(BARSLAST(CC2),1);
KK2:=BACKSET(II2,JJ2+2);
LL2:=KK2>REF(KK2,1);
DRAWLINE(LL2,TY,II2,TY,1),COLORblue,DOTLINE;
{RSICD}
RSI: eMA(RSI1,n)+50;
RSEA : EMA(RSI,p);
RSCD:2*(RSI-RSEA),linethick0;
bbRSI:=RSI-ref(RSI,1);
bbRSEA:=RSEA-ref(RSEA,1);
bbRSCD:=RSCD-ref(RSCD,1);
PARTLINE(bbRSI>0,RSI),color0066ff,LINETHICK2;
PARTLINE(bbRSI<0,RSI),colorcyan,LINETHICK2;
PARTLINE(bbRSEA>0,RSEA),colormagenta,LINETHICK2;
PARTLINE(bbRSEA<0,RSEA),color009999,LINETHICK2;
RSI速率:=bbRSI*100;
RSEA速率:=bbRSEA*100;
RSCD速率:=bbRSCD*100;
{KD}
RSV:=(CLOSE-LLV(LOW,9))/(HHV(HIGH,9)-LLV(LOW,9))*100;
K:SMA(RSV,3,1);
D:SMA(K,3,1);
bbK:=K-ref(K,1);
bbD:=D-ref(D,1);
PARTLINE(bbD>0,D),coloryellow,LINETHICK2;
PARTLINE(bbD<=0,D),color00ff33,LINETHICK2;
PARTLINE(bbK>0,K),colorcc00ff,LINETHICK2;
PARTLINE(bbK<=0,K),colorwhite,LINETHICK2;
K速率:bbK*100,LINETHICK0;
D速率:bbD*100,LINETHICK0;

大智慧RSI核心指标公式

 

相关文章