//基础指标公式
50,DOTLINE;20;80;
DRAWBAND(80,RGB(0,30,255),100,RGB(0,30,255));
DRAWBAND(20,RGB(0,150,200),0,RGB(0,150,200));
DRAWTEXT_FIX(1,0.02,0,0,'★RSI6与RSA12金叉参考买入.死叉参考卖出. ★威廉WR大于80买入区.小于20卖出区.'),COLOR00FFFF,LINETHICK3;
CC:=FORCAST(C,3); HH:=FORCAST(H,3); LL:=FORCAST(L,3);
LC:=REF(WMA((2*CC+HH+LL)/4,3),1);
RSI6:SMA(MAX(CLOSE-LC,0),6,1)/SMA(ABS(CLOSE-LC),6,1)*100,COLORFF9900,LINETHICK0;
RSI12:SMA(MAX(CLOSE-LC,0),12,1)/SMA(ABS(CLOSE-LC),12,1)*100,COLOR00FFFF,LINETHICK0;
DRAWBAND(RSI6,RGB(255,80,0),RSI12,RGB(0,255,100));
SMA(MAX(CLOSE-LC,0),6,1)/SMA(ABS(CLOSE-LC),6,1)*100,COLORFF9900,LINETHICK3;
IF(RSI6>REF(RSI6,1),RSI6,DRAWNULL),COLOR0000FF,LINETHICK4;
SMA(MAX(CLOSE-LC,0),12,1)/SMA(ABS(CLOSE-LC),12,1)*100,COLOR00FFFF,LINETHICK2;
威廉WR:FORCAST(100*(HHV(HH,14)-CC)/(HHV(HH,14)-LLV(LL,14)),5),COLOR00FFFF,DOTLINE;
IF(威廉WR>80 ,威廉WR,DRAWNULL),COLOR00FF00,LINETHICK3;
IF(威廉WR<20,威廉WR,DRAWNULL),COLOR0000FF,LINETHICK3;
导入软件之后的基本走势图形有:
//买卖指标公式
N1:=6;
N2:=6;
N3:=6;
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;
MA60:MA(C,60);
MA5:MA(C,5);
MA10:MA(C,10);
MA20:MA(C,20);
A:20;
D:80;
买:=RSI1<20 OR RSI1<80 AND C>REF(C,1)AND VOLREF(MA60,1) AND MA5>REF(MA5,1)AND MA10>REF(MA10,1)AND MA20>REF(MA20,1);
DRAWTEXT(买,RSI1*0.8,'买'),COLOR0099FF;
卖:=RSI1>80 AND VOL>REF(VOL,1);
DRAWTEXT(卖,RSI1*1.09,'卖'),COLOR0099FF;
//精确买卖点公式
LC := REF(CLOSE,1);
R:SMA(MAX(CLOSE-LC,0),9,1)/SMA(ABS(CLOSE-LC),9,1)*10;
K:=r-REF(r,1);
STICKLINE(k>REF(k,1) AND R<3 AND (k<0 OR REF(k,1)<0),3,5,2),colorred;
STICKLINE(k5.5,5,7,2),colorgreen;
x:=(k>REF(k,1) AND R<3.0 AND (k<0 OR REF(k,1)<0))*8;
y:=((k5.5)>0)*8;
//趋势分析
VAR1:=HHV(HIGH,33);
VAR2:=LLV(LOW,33);
A:=(SMA((CLOSE-VAR2)/(VAR1-VAR2),8,1))*(100),COLOR00FFFF;
价格线:EMA(HHV(A,3),1),colorgreen;
va1:=(CLOSE-LLV(LOW,90))/(HHV(HIGH,90)-LLV(LOW,90))*100;
va2:=SMA(va1,9,1),colorwhite;
趋势线:SMA(va2,6,1),colorff00ff;
va4:=3*va2-2*趋势线,colorff00ff;
撑压线:WMA((va2+趋势线+va4)/3,60),colorred;
LC:= REF(CLOSE,1);
RSI6:SMA(MAX(CLOSE-LC,0),6,1)/SMA(ABS(CLOSE-LC),6,1)*100,colorwhite;
RSI12:SMA(MAX(CLOSE-LC,0),12,1)/SMA(ABS(CLOSE-LC),12,1)*100,coloryellow;
卖线:85,LINETHICK02,POINTDOT,Color15FF15;
界线:50,LINETHICK02,POINTDOT,ColorFF1EFF;
买线:20,LINETHICK02,POINTDOT,Color28FFFF;
其中讲解的主要是有买线和卖线的操作技巧,以及趋势线和撑压线,导入后的基本图形如下:
//rsi自用公式
N0:=3;N1:=5;N2:=6;N3:=7;N4:=8;N5:=9;N6:=10;N7:=11;N8:=12;N9:=13;N10:=14;N11:=15;N12:=16;
LC := REF(CLOSE,1);
RSI$12:SMA(MAX(CLOSE-LC,0),N12,1)/SMA(ABS(CLOSE-LC),N12,1)*100,COLORFFFF00;
RSI$11:SMA(MAX(CLOSE-LC,0),N11,1)/SMA(ABS(CLOSE-LC),N11,1)*100,COLORFFCC00;
RSI$10:SMA(MAX(CLOSE-LC,0),N10,1)/SMA(ABS(CLOSE-LC),N10,1)*100,COLORFF9900;
RSI$9:SMA(MAX(CLOSE-LC,0),N9,1)/SMA(ABS(CLOSE-LC),N9,1)*100,COLORFF6600;
RSI$8:SMA(MAX(CLOSE-LC,0),N8,1)/SMA(ABS(CLOSE-LC),N8,1)*100,COLORFF3300;
RSI$7:SMA(MAX(CLOSE-LC,0),N7,1)/SMA(ABS(CLOSE-LC),N7,1)*100,COLORFF0000;
RSI$6:SMA(MAX(CLOSE-LC,0),N6,1)/SMA(ABS(CLOSE-LC),N6,1)*100,COLOR00FFFF;
RSI$5:SMA(MAX(CLOSE-LC,0),N5,1)/SMA(ABS(CLOSE-LC),N5,1)*100,COLOR00CCFF;
RSI$4:SMA(MAX(CLOSE-LC,0),N4,1)/SMA(ABS(CLOSE-LC),N4,1)*100,COLOR0099FF;
RSI$3:SMA(MAX(CLOSE-LC,0),N3,1)/SMA(ABS(CLOSE-LC),N3,1)*100,COLOR0066FF;
RSI$2:SMA(MAX(CLOSE-LC,0),N2,1)/SMA(ABS(CLOSE-LC),N2,1)*100,COLOR0033FF;
RSI$1:SMA(MAX(CLOSE-LC,0),N1,1)/SMA(ABS(CLOSE-LC),N1,1)*100,COLOR0000FF;
RSI$0:SMA(MAX(CLOSE-LC,0),N0,1)/SMA(ABS(CLOSE-LC),N0,1)*100,COLORFF33FF;
a:20;
d:80;
//复合通道公式
M=12,2,10;
N1=6,2,100;
N2=13,2,100;
LC:=REF(CLOSE,1);
RS1:=SMA(MAX(CLOSE-LC,0),M,1)/SMA(ABS(CLOSE-LC),M,1)*100;
ATR:=MA(MAX(MAX((RS1-RS1),ABS(REF(RS1,1)-RS1)),ABS(REF(RS1,1)-RS1)),15);
VM:=MA(RS1,N1);
SM:MA(RS1,20),PRECIS1,Coloraaee00,LINETHICK0;
SU:SM+2*STD(RS1,20),PRECIS1,Coloraaee00,LINETHICK0;
SD:SM-2*STD(RS1,20),PRECIS1,Coloraaee00,LINETHICK0;
VU:VM+2.3*ATR,PRECIS1,Colorffffff,LINETHICK0;
VD:VM-2.1*ATR,PRECIS1,Colorffffff,LINETHICK0;
//{DRAWGBKLAST(C>0),Color7a6500};
FILLRGN(SU,SD,C>0,RGB(0,170,140)),PRECIS1;
FILLRGN(VU,VD,C>0,RGB(210,210,210)),PRECIS1;
RSI:RS1,PRECIS1,Color0000ff,LINETHICK2,LAYER0;
MA1:VM,PRECIS1,Colorff0000;
MA2:MA(RS1,N2),PRECIS1,Color004a00,LINETHICK2;
强势:70,colorred,LAYER3;
中势:50,colorblue,LAYER3;
弱势:30,colorgreen,LAYER3;
其中能够表现出股价的强势和弱势,基本的图形如下:
TAG:rsi指标公式源码