另类RSI股票指标公式源码(附图)
2020/11/10 19:57:12
在股市中技术指标是最简单的股票行情分析工具,但是在这些指标中其基本的源码公式是可以进行编译的,这样就能够方便投资者进行实战中的股票走势分析,比如是RSI指标公式的源码经过多方面的编译,有很多不同的公式应用方法,对应的走势图形也有所不同。
第一:通用公式源码
N:=3;
N1:=5;
N2:=10;
N3:=20;
N4:=1;
M1:=7;
M2:=2;
LC :=REF(C,N4);
RSI1:SMA(MAX(C-LC,0),N1,1)/SMA(ABS(C-LC),N1,1)*100,COLOR000000,LINETHICK1;
RSI2:SMA(MAX(C-LC,0),N2,1)/SMA(ABS(C-LC),N2,1)*100,COLORBLUE,LINETHICK1;
RSI3:SMA(MAX(C-LC,0),N3,1)/SMA(ABS(C-LC),N3,1)*100,COLOR009900,LINETHICK1;
IF(RSI1<=RSI2 AND RSI2<=RSI3,RSI1,DRAWNULL),COLORCYAN,LINETHICK1;
IF(RSI2<=RSI3 AND RSI2>=RSI1,RSI2,DRAWNULL),COLORCYAN,LINETHICK1;
IF(RSI3>=RSI2 AND RSI2>=RSI1,RSI3,DRAWNULL)COLORCYAN,LINETHICK1;
IF(RSI1>=RSI2 AND RSI2>=RSI3,RSI1,DRAWNULL),COLORRED,LINETHICK1;
IF(RSI2>=RSI3 AND RSI2<=RSI1,RSI2,DRAWNULL),COLORRED,LINETHICK1;
IF(RSI3<=RSI2 AND RSI2<=RSI1,RSI3,DRAWNULL)COLORRED,LINETHICK1;
DRAWTEXT(RSI1>=RSI2 AND RSI2>=RSI3 AND RSI3>=30,90,'△'),COLORRED;
DRAWTEXT(RSI1<=RSI2 AND RSI2<=RSI3 AND RSI3<=80,85,'▽'),COLORCYAN;
DRAWTEXT(RSI1>=80,80,'★'),COLORBLUE;
DRAWTEXT(RSI1<=15,20,'★'),COLOR000000;
DRAWTEXT(RSI1>=50 AND RSI2>=50 AND RSI3>=50,90,'▲'),COLORRED,LINETHICK3;
DRAWTEXT(RSI1<=50 AND RSI2<=50 AND RSI3<=50,85,'▼'),COLORCYAN,LINETHICK3;
TY:=RSI1;{通用曲线值的引入}
AA:=REF(TY,N)=HHV(TY,2*N+1);
BB:=BACKSET(AA,N+1);
CC:=FILTER(BB,N) AND TY=HHV(TY,N+1);
AA2:=REF(TY,N)=LLV(TY,2*N+1);
BB2:=BACKSET(AA2,N+1);
CC2:=FILTER(BB2,N) AND TY=LLV(TY,N+1);
GG:=ISLASTBAR 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),COLORRED,LINETHICK2;
CS:=(REF(TY,BARSLAST(II))-REF(TY,BARSLAST(LL)))/(BARSLAST(LL)-BARSLAST(II));
阻力线:=REF(TY,BARSLAST(II))+BARSLAST(II)*CS;
阻力值:阻力线,LINETHICK2;
DRAWICON(CROSS(TY,阻力线),阻力线*0.50,33);
GG2:=ISLASTBAR 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,LINETHICK2;
20,COLOR009900,POINTDOT,LINETHICK1;
50,COLORBLUE,LINETHICK1;
80,COLORRED,POINTDOT,LINETHICK1;
{顶底}
DRAWTEXT(MACD>=0 AND CR>=100 AND KD>=80 AND RSI>=80 ,80,'【卖】'),COLORBLUE;
DRAWTEXT(MACD<=0 AND CR<=100 AND RSI<=20 AND KD<=20,5,'【买】'),COLOR000000;
{CR上60手机}
DRAWICON(CROSS(CR,60),60,20);
{RSI上20苹果}
DRAWICON(CROSS(RSI,15),60,16);
{KD上15笑脸}
DRAWICON(CROSS(KD,15),60,5);
{CCI上-200钻石}
DRAWICON( CROSS(CCI,-200) AND CCI>=REF(CCI,1),0,25);
{起爆点}
DIF1:=EMA(DCLOSE,2)-EMA(DCLOSE,3);
DEA1:=EMA(DIF1,4);
AAA1:=(DIF1-DEA1)*2*60;
起爆点:=AAA1-REF(AAA1,1);
DRAWICON(CROSS(起爆点,4),60,9);
{起跌点}
起跌点:=REF(AAA1,1)-AAA1;
DRAWICON(CROSS(起跌点, 4),60,15);
主要讲解的是指标线中的阻力线和压力线,以及在实战中的起爆点、起跌点和顶部底部的识别和判断,希望投资者能够根据具体的图形走势进行分析。
第二:多周期RSI指标公式
LC:=REF(CLOSE,1);
RSI11:MA(SMA(MAX(CLOSE-LC,0),11,1)/SMA(ABS(CLOSE-LC),11,1)*100,3),COLORRED;
RSI13:MA(SMA(MAX(CLOSE-LC,0),13,1)/SMA(ABS(CLOSE-LC),13,1)*100,3),COLORRED;
RSI15:MA(SMA(MAX(CLOSE-LC,0),15,1)/SMA(ABS(CLOSE-LC),15,1)*100,3),COLORRED;
RSI17:MA(SMA(MAX(CLOSE-LC,0),17,1)/SMA(ABS(CLOSE-LC),17,1)*100,3),COLORRED;
RSI20:MA(SMA(MAX(CLOSE-LC,0),20,1)/SMA(ABS(CLOSE-LC),20,1)*100,3),COLORRED;
RSI30:MA(SMA(MAX(CLOSE-LC,0),30,1)/SMA(ABS(CLOSE-LC),30,1)*100,3),COLORGREEN;
RSI35:MA(SMA(MAX(CLOSE-LC,0),35,1)/SMA(ABS(CLOSE-LC),35,1)*100,3),COLORGREEN;
RSI40:MA(SMA(MAX(CLOSE-LC,0),40,1)/SMA(ABS(CLOSE-LC),40,1)*100,3),COLORGREEN;
RSI45:MA(SMA(MAX(CLOSE-LC,0),45,1)/SMA(ABS(CLOSE-LC),45,1)*100,3),COLORGREEN;
RSI50:MA(SMA(MAX(CLOSE-LC,0),50,1)/SMA(ABS(CLOSE-LC),50,1)*100,3),COLORGREEN;
RSI100:SMA(MAX(CLOSE-LC,0),100,1)/SMA(ABS(CLOSE-LC),100,1)*100,COLORYELLOW;
RSI150:SMA(MAX(CLOSE-LC,0),150,1)/SMA(ABS(CLOSE-LC),150,1)*100,COLORYELLOW;
RSI200:SMA(MAX(CLOSE-LC,0),200,1)/SMA(ABS(CLOSE-LC),200,1)*100,COLORYELLOW;
RSI250:SMA(MAX(CLOSE-LC,0),250,1)/SMA(ABS(CLOSE-LC),250,1)*100,COLORYELLOW;
RSI300:SMA(MAX(CLOSE-LC,0),300,1)/SMA(ABS(CLOSE-LC),300,1)*100,COLORYELLOW;
50,POINTDOT;
指的是RSI指标在多周期中的应用方法和技巧,其周期与K线的周期划分是一致的,有分钟线、小时线的以及日线、周线和月线的周期分析方法,具体的走势结合下面的图形可以进行研究和分析。
第三种:rsi三级跳指标公式
VAR1:=100-90*(HHV(HIGH,20)-CLOSE)/(HHV(HIGH,20)-LLV(LOW,20));
VAR2:=100-90*(HHV(HIGH,20)-CLOSE)/(HHV(HIGH,20)-LLV(LOW,20));
VAR3:=100-MA(100*(HHV(HIGH,6)-CLOSE)/(HHV(HIGH,6)-LLV(LOW,6)),28);
买入信号: IF(VAR2
卖出信号: IF(VAR1>MA(VAR3,6),MA(VAR3,6),VAR1),COLORGREEN,LINETHICK2;
强弱线: MA(VAR3,6),COLORYELLOW ,LINETHICK1;
海面:25,COLORGREEN;
分界线:50,COLORWHITE;
天际:75,COLORMAGENTA;
其中,主要介绍的是指标走势中的买入信号和卖出信号,以及强弱线的分界线和实战技巧,而在图中的显示是依据股价的走势产生的买卖信号。
第四种:RSI三线交合公式
N1:=6;N2:=12;N3:=24;
LC:=REF(CLOSE,1);
RSI1:=SMA(MAX(CLOSE-LC,0),N1,1)/SMA(ABS(CLOSE-LC),N1,1)*100;
RSI2:=SMA(MAX(CLOSE-LC,0),N2,1)/SMA(ABS(CLOSE-LC),N2,1)*100;
RSI3:=SMA(MAX(CLOSE-LC,0),N3,1)/SMA(ABS(CLOSE-LC),N3,1)*100;
AA1:IF(RSI1
AA2:IF(RSI1
AA3:RSI3,COLORBLUE;
我们需要明确的是rsi指标具有三条线的基本走势,当三条线粘合在一起的时候,有可能是形成的上涨的金叉走势,也可能是死叉的卖出信号,其公式的源码图形如下:
第五种:另类RSI指标公式
虽然说指标的源码公式是可以修改编译的,但是想要正确的编译股票公式,还需要了解基本的公式源码,如rsi另类指标的公式如下:
rsi12:SMA((c-ref(c,1)),12,1)/SMA(ABS(c-ref(c,1)),12,1)*100,COLORWHITE;
FRSI36:-SMA((c-ref(c,1)),36,1)/SMA(ABS(c-ref(c,1)),36,1)*100,COLORGREEN;
0,COLORRED;
修改之后的,源码显示的是两条线的走势,可以更加清楚的显示股价对应的买入点和卖出点位置。
以上就是本文讲解的5种另类的rsi指标公式源码,如果您还想要了解更多的股市操作源码公式,请点击股票技术指标公式,为您提供更加全面的技术指标公式源码解析和案例分享。