飞狐KDJ月周日指标公式

[复制链接]
查看81 | 回复0 | 2021-8-21 12:41:19 | 显示全部楼层 |阅读模式

input:nr(9,1,500,1),mr1(3,1,100,1),mr2(3,1,100,1),{ 日kdj参数 }
nw(9,1,500,1),mw1(3,1,100,1),mw2(3,1,100,1),{ 周kdj参数 }
nm(9,1,500,1),mm1(3,1,100,1),mm2(3,1,100,1);{ 月kdj参数 }
REFLINE: 0,20, 50, 80,100,150,180,200,250,300;
{ 日KDJ金叉 }
RSVR:=(CLOSE-LLV(LOW,NR))/(HHV(HIGH,NR)-LLV(LOW,NR))*100;
KR0:=SMA(RSVR,MR1,1);
kr:kr0+200,ColorFF0000;
DR0:=SMA(KR0,MR2,1);
dr:dr0+200,ColorFF0000,linethick2;
JR:3*KR-2*DR,color00ff00;
日金叉:=FILTER(cross(Kr0,Dr0),5){,colorffffff,linethick0};
stickline(日金叉,kr,kr*1.10,1,0),colorffffff,linethick2;
drawtext(日金叉,kr*1.10,'日金叉'),colorffffff,linethick1;
{ 周KDJ金叉 }
ZCw:=IF(BARPOS=1,1,DAYS1970-ref(DAYS1970,1)<>WEEKDAY-REF(WEEKDAY,1));
{上市第一日ZC取1,每周初交易日取1,其他交易日取0 }
STICKLINE(zcw ,100 ,110 ,0.8 ,1 ),colorff00ff;
Xw:=SUMBARS(ZCw,Nw);
Mw:=BARSLAST(ZCw)+1; { 最后一周交易日 }
RSVw:=(CLOSE-LLV(LOW,Xw))/(HHV(HIGH,Xw)-LLV(LOW,Xw))*100;
Kw0:=((RSVw+(Mw1-1)*REF("KDJ.K#WEEK",Mw))/Mw1);
kw:kw0+100,colorff00ff;
Dw0:=(Kw0+(Mw2-1)*REF("KDJ.D#WEEK",Mw))/Mw2;
dw:dw0+100,colorff00ff,linethick2;
Jw:3*Kw-2*Dw,Color00FFFF;
周金叉:=FILTER(cross(KW0,DW0),5){,colorffffff,linethick0};
stickline(周金叉,kw,kw*1.20,1,0),colorff00ff,linethick2;
drawtext(周金叉,kw*1.20,'周金叉'),colorff00ff,linethick1;
{ 月KDJ金叉 }
ZCM:=IF(BARPOS=1,1,BARPOS-ref(BARPOS,1)=1 and month<>ref(month,1));
{上市第一日ZC取1,每月初交易日取1,其他交易日取0 }
STICKLINE(zcm ,0 ,10 ,0.8 ,1 ),coloraaaaff;
XM:=SUMBARS(ZCM,NM);
MM:=BARSLAST(ZCM)+1; { 最后一月交易日 }
RSVM:=(CLOSE-LLV(LOW,XM))/(HHV(HIGH,XM)-LLV(LOW,XM))*100;
Km:(RSVM+(MM1-1)*REF("KDJ.K#month",MM))/MM1,coloraaaaff;
Dm:(Km+(MM2-1)*REF("KDJ.D#month",MM))/MM2,coloraaaaff,linethick2;
Jm:3*Km-2*Dm,;
月金叉:=FILTER(cross(Km,Dm),5){,coloraaaaff,linethick0};
stickline(月金叉,km,km*1.8,1,0),coloraaaaff,linethick2;
drawtext(月金叉,km*1.8,'月金叉'),coloraaaaff,linethick1;
PARTLINE(jm>80,jm),colorred;
{ KDJ共振 }
三金叉:FILTER(SUM(日金叉,5)>=1 AND SUM(周金叉,5)>=1 AND
SUM(月金叉,10)>=1,5),color0000ff,linethick0;
STICKLINE(三金叉 ,0 ,200 ,1 ,0 ),color0000ff,linethick3;
drawtext(三金叉,200,'月周日三金叉'),color0000ff,linethick2;
0,coloraaaaaa;100,coloraaaaaa;200,coloraaaaaa;
{公式名称:KD月周日
公式描述:逐日显示日,周,月三周期kdj};

202108211200.jpg

202108211200.jpg

 

回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则