手机端
当前位置:爱约股 > 公式技巧 > 修改“RSI划线”副图及选股公式 为 飞狐 软件 可用

修改“RSI划线”副图及选股公式 为 飞狐 软件 可用

参数:
N1:2,120,5;
N2:2,250,10;
N3:2,500,20;
P:1,20,3;

{参数:P:1,20,3;}{支撑压力线的周期参数 P可调}


STICKLINE(C>0,0,30,10,0),COLOR353535;
STICKLINE(C>0,30,50,10,0),COLOR454545;
STICKLINE(C>0,50,80,10,0),COLOR555555;
STICKLINE(C>0,80,95,10,0),COLOR757575;
强弱线:50,LINETHICK2,COLOR858585;
警示线:80,POINTDOT,COLORCYAN;
减仓线:90,COLOR00AA55,LINETHICK2;
清仓线:95,COLOR0000AA,LINETHICK2;
LC:=REF(CLOSE,1);
RSI5:SMA(MAX(CLOSE-LC,0),N1,1)/SMA(ABS(CLOSE-LC),N1,1)*100,NODRAW,COLORFFAAFF;
RSI10:SMA(MAX(CLOSE-LC,0),N2,1)/SMA(ABS(CLOSE-LC),N2,1)*100,NODRAW,COLORDDAADD;
RSI20:SMA(MAX(CLOSE-LC,0),N3,1)/SMA(ABS(CLOSE-LC),N3,1)*100,NODRAW,COLORAA99AA;
DRAWBAND(RSI5,RGB(195,125,195),RSI10,RGB(0,130,50));
DRAWBAND(RSI10,RGB(165,95,165),RSI20,RGB(0,100,20));
{金叉死叉}
金叉:CROSS(RSI5,RSI20) AND CROSS(RSI10,RSI20),COLORRED,NODRAW;
DRAWTEXT(金叉,RSI5,'←'),COLORRED;
死叉:CROSS(RSI20,RSI10) AND CROSS(RSI20,RSI5),COLORGREEN,NODRAW;
DRAWTEXT(死叉,RSI5,'←'),COLORGREEN;
{RSI顶底背离}
RS:=BARSLAST(REF(CROSS(RSI20,RSI5),1));
RS1:=REF(CLOSE,RS+1)<CLOSE AND REF(RSI5,RS+1)>RSI5 AND CROSS(RSI20,RSI5);
顶背离:IF(RS1,RSI5,DRAWNULL),CIRCLEDOT,COLORFFCC00;
STICKLINE(RS1,RSI5,RSI5*0.9,0,0),COLORFFCC00;
DRAWTEXT(RS1,RSI5*0.9,'顶背离'),COLORFFCC00;
S1:=BARSLAST(REF(CROSS(RSI5,RSI20),1));
S1A:=REF(CLOSE,S1+1)>CLOSE AND RSI5>REF(RSI5,S1+1) AND
CROSS(RSI5,RSI20);
底背离:IF(S1A,RSI5,DRAWNULL),CIRCLEDOT,COLOR6699FF;
STICKLINE(S1A,RSI5,RSI5*1.1,0,0),COLOR6699FF;
DRAWTEXT(S1A,RSI5*1.1,'底背离'),COLOR6699FF;
{RSI划线}
OB:=RSI5;
A1:=REF(OB,P)=HHV(OB,2*P+1);
B1:=FILTER(A1,P);
C1:=BACKSET(B1,P+1);
D1:=FILTER(C1,P);{高点}
A2:=REF(OB,P)=LLV(OB,2*P+1);
B2:=FILTER(A2,P);
C2:=BACKSET(B2,P+1);
D2:=FILTER(C2,P);{低点}
R11:=BACKSET(ISLASTBAR,BARSLAST(D1)+1);
S11:=R11>REF(R11,1);
压力线:DRAWLINE(D1,OB,S11,OB,1),LINETHICK1,COLORCC33CC;
T11:=BACKSET(ISLASTBAR,BARSLAST(D2)+1);
U11:=T11>REF(T11,1);
支撑线:DRAWLINE(D2,OB,U11,OB,1),COLOR00CCCC;

AA:95,COLORGREEN;
BB:90,COLORCYAN;
CC:45,COLORYELLOW;
DD:80,COLORMAGENTA;
EE:10,COLORRED;
DRAWTEXT(ISLASTBAR,AA,'清仓');
DRAWTEXT(ISLASTBAR,BB,'减仓');
DRAWTEXT(ISLASTBAR,DD,'警觉');
DRAWTEXT(CURRBARSCOUNT=60,25,'强弱用来看趋势 背离用来看顶底'),COLORCC99FF;
DRAWTEXT(CURRBARSCOUNT=60,15,'支撑压力辨起落 设定周期参数 P'),COLORCC99FF;

{第二部分卖出信号}
LLC:=REF(CLOSE,1);
RSI:=SMA(MAX(CLOSE-LLC,0),6,1)/SMA(ABS(CLOSE-LLC),6,1)*100;
顶部:CROSS(80,RSI)*30,LINETHICK2 ,COLORGREEN;
DRAWTEXT(CROSS(80,RSI),20,'见顶 '),COLORGREEN;
持股:(CLOSE-REF(CLOSE,5))/ABS(CLOSE-REF(CLOSE,5))*10,COLORYELLOW;
STICKLINE(持股>0,0,持股,5,0),COLORLIRED;
STICKLINE(持股<0,0,持股,5,1),COLORBLUE;

底背离选股公式

N1:=5;
N3:=20;
LC:=REF(CLOSE,1);
RSI5:=SMA(MAX(CLOSE-LC,0),N1,1)/SMA(ABS(CLOSE-LC),N1,1)*100;
RSI20:=SMA(MAX(CLOSE-LC,0),N3,1)/SMA(ABS(CLOSE-LC),N3,1)*100;
S1:=BARSLAST(REF(CROSS(RSI5,RSI20),1));
底背离:REF(CLOSE,S1+1)>CLOSE AND RSI5>REF(RSI5,S1+1) AND CROSS(RSI5,RSI20);


请 老师 帮忙 把此 副图及选股公式 修改成 飞狐 软件 可用!

解答如下:

选股公式不用改

N1:=5;
N2:=10;
N3:=20;
P:=3;
{参数:P:1,20,3;}{支撑压力线的周期参数 P可调}
STICKLINE(C>0,0,30,10,0),COLOR353535;
STICKLINE(C>0,30,50,10,0),COLOR454545;
STICKLINE(C>0,50,80,10,0),COLOR555555;
STICKLINE(C>0,80,95,10,0),COLOR757575;
强弱线:50,LINETHICK2,COLOR858585;
警示线:80,POINTDOT,COLORCYAN;
减仓线:90,COLOR00AA55,LINETHICK2;
清仓线:95,COLOR0000AA,LINETHICK2;
LC:=REF(CLOSE,1);
RSI5:SMA(MAX(CLOSE-LC,0),N1,1)/SMA(ABS(CLOSE-LC),N1,1)*100,linethick0,COLORFFAAFF;
RSI10:SMA(MAX(CLOSE-LC,0),N2,1)/SMA(ABS(CLOSE-LC),N2,1)*100,linethick0,COLORDDAADD;
RSI20:SMA(MAX(CLOSE-LC,0),N3,1)/SMA(ABS(CLOSE-LC),N3,1)*100,linethick0,COLORAA99AA;
{DRAWBAND(RSI5,RGB(195,125,195),RSI10,RGB(0,130,50));
DRAWBAND(RSI10,RGB(165,95,165),RSI20,RGB(0,100,20));}
fillrgn(rsi5>rsi10,rsi5,rsi10),colorc07fc0;
fillrgn(rsi5<rsi10,rsi5,rsi10),color008713;
fillrgn(rsi10>rsi20,rsi10,rsi20),colora55ca5;
fillrgn(rsi10<rsi20,rsi10,rsi20),color006313;

{金叉死叉}
金叉:CROSS(RSI5,RSI20) AND CROSS(RSI10,RSI20),COLORRED,linethick0;
DRAWTEXT(金叉,RSI5,'←'),COLORRED;
死叉:CROSS(RSI20,RSI10) AND CROSS(RSI20,RSI5),COLORGREEN,linethick0;
DRAWTEXT(死叉,RSI5,'←'),COLORGREEN;
{RSI顶底背离}
RS:=BARSLAST(REF(CROSS(RSI20,RSI5),1));
RS1:=REF(CLOSE,RS+1)<CLOSE AND REF(RSI5,RS+1)>RSI5 AND CROSS(RSI20,RSI5);
顶背离:partline(RS1,RSI5),CIRCLEDOT,COLORFFCC00;
STICKLINE(RS1,RSI5,RSI5*0.9,0,0),COLORFFCC00;
DRAWTEXT(RS1,RSI5*0.9,'顶背离'),COLORFFCC00;
S1:=BARSLAST(REF(CROSS(RSI5,RSI20),1));
S1A:=REF(CLOSE,S1+1)>CLOSE AND RSI5>REF(RSI5,S1+1) AND
CROSS(RSI5,RSI20);
底背离:partline(S1A,RSI5),CIRCLEDOT,COLOR6699FF;
STICKLINE(S1A,RSI5,RSI5*1.1,0,0),COLOR6699FF;
DRAWTEXT(S1A,RSI5*1.1,'底背离'),COLOR6699FF;
{RSI划线}
OB:=RSI5;
A1:=REF(OB,P)=HHV(OB,2*P+1);
B1:=FILTER(A1,P);
C1:=BACKSET(B1,P+1);
D1:=FILTER(C1,P);{高点}
A2:=REF(OB,P)=LLV(OB,2*P+1);
B2:=FILTER(A2,P);
C2:=BACKSET(B2,P+1);
D2:=FILTER(C2,P);{低点}
R11:=BACKSET(ISLASTBAR,BARSLAST(D1)+1);
S11:=R11>REF(R11,1);
压力线:DRAWLINE(D1,OB,S11,OB,1),LINETHICK1,COLORCC33CC;
T11:=BACKSET(ISLASTBAR,BARSLAST(D2)+1);
U11:=T11>REF(T11,1);
支撑线:DRAWLINE(D2,OB,U11,OB,1),COLOR00CCCC;

分享至:

相关推荐