通达信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);
- 上一篇公式:通达信MACD通用指标(源码)
- 下一篇公式:通达信预测中短期MA主图指标(源码)