当前位置:→ 股海网大智慧公式 → 正文
  • 无引用飞狐周MACD、周RSI、周KDJ 指标的大智慧表达式

  • 相关简介:无引用飞狐周MACD、周RSI、周KDJ 指标的大智慧表达式 三个指标的原码如下:复制内容到剪贴板代码: {周MACD} input:long(26,20,100),short(12,5,40),m(9,2,60); wtj1:=datediff(ref(date,1),date)weekday-ref(weekday,1) or barpos=1; wtj:=refx(wtj1,1) or weekday=5; //周末标记 fc:=close; start:=barpos-barssince

  • 文章来源:Admin作者:股海网发布时间:2011-04-26浏览次数:下载次数:0

无引用飞狐周MACD、周RSI、周KDJ 指标的大智慧表达式
 

三个指标的原码如下:复制内容到剪贴板代码:
{周MACD}
input:long(26,20,100),short(12,5,40),m(9,2,60);
wtj1:=datediff(ref(date,1),date)<>weekday-ref(weekday,1) or barpos=1;
wtj:=refx(wtj1,1) or weekday=5; //周末标记
fc:=close;
start:=barpos-barssince(wtj);
diff:0*close;
dea:0*close;
tmp:=setlbound(diff,start[datacount]);
tmp:=setlbound(dea,start[datacount]);
d1:=fc[start[datacount]];d2:=d1;wdea:=0;
for i=start[datacount]+1 to datacount do begin
if wtj then begin
d1:=(2*fc+(short-1)*d1)/(short+1);
d2:=(2*fc+(long-1)*d2)/(long+1);
wdiff:=d1-d2;
wdea:=(2*wdiff+(m-1)*wdea)/(m+1);
diff:=wdiff;
dea:=wdea;
end else begin
diff:=(2*fc+(short-1)*d1)/(short+1)-
(2*fc+(long-1)*d2)/(long+1);
dea:=(2*diff+(m-1)*wdea)/(m+1);
end;
end;
macd:2*(diff-dea),colorstick;

{//以下检查dea数据是否正确
weekdea:"macd.dea#week";
drawicon(wtj,0,10);
tt:count(round(weekdea*100000-dea*100000)*wtj,0);//每个周末的数据是否相同进行统计,精确小数点后5位。}

低位金叉:=CROSS(DIFF,DEA) AND DIFF<-0.1;
STICKLINE(低位金叉,0,0.3,8,0),COLORYELLOW;
JCCOUNT:=COUNT(CROSS(DIFF,DEA),BARSLAST(DEA>=0));
二次金叉:=CROSS(DIFF,DEA) AND DEA<0 AND COUNT(JCCOUNT=2,21)=1;
STICKLINE(二次金叉,0,0.2,8,0),COLORff80ff;
DRAWICON(二次金叉,dea*0.9,1) ;
A1:=BARSLAST(REF(CROSS(DIFF,DEA),1));
底背离:=REF(CLOSE,A1+1)>CLOSE AND DIFF>REF(DIFF,A1+1) AND CROSS(DIFF,DEA);
STICKLINE(底背离,0,0.1,8,0),COLORRED;
DRAWLINE(A1=0,DEA,底背离,DEA,0),COLORRED,linethick1;
A2:=BARSLAST(REF(CROSS(DEA,DIFF),1));
顶背离:=REF(CLOSE,A2+1)<CLOSE AND REF(DIFF,A2+1)>DIFF AND CROSS(DEA,DIFF);
DRAWLINE(A2=0,DEA,顶背离,DEA,0),COLORGREEN,linethick1;复制内容到剪贴板代码:
{周RSI}
input:n1(6),n2(12),n3(24);
wtj1:=datediff(ref(date,1),date)<>weekday-ref(weekday,1) or barpos=1;
wtj:=refx(wtj1,1); //周末标记
lc := ref(close,barslast(wtj1)+1);
wcc:=barpos-sumbars(wtj,count(wtj,0)-1)+1;
start:=wcc[datacount];
maxc:=max(close-lc,0);
absc:=abs(close-lc);
r11:=maxc[start]; r12:=absc[start];
r21:=r11; r31:=r11; r22:=r12; r32:=r12;
zrsi1[start]:r11/r12*100;
zrsi2[start]:r21/r22*100;
zrsi3[start]:r31/r32*100;
for i=start+1 to datacount do begin
if wtj then begin
r11:=(maxc+(n1-1)*r11)/n1;
r12:=(absc+(n1-1)*r12)/n1;
r21:=(maxc+(n2-1)*r21)/n2;
r22:=(absc+(n2-1)*r22)/n2;
r31:=(maxc+(n3-1)*r31)/n3;
r32:=(absc+(n3-1)*r32)/n3;
zrsi1:=r11/r12*100;
zrsi2:=r21/r22*100;
zrsi3:=r31/r32*100;
end else begin
zrsi1:=(maxc+(n1-1)*r11)/(absc+(n1-1)*r12)*100;
zrsi2:=(maxc+(n2-1)*r21)/(absc+(n2-1)*r22)*100;
zrsi3:=(maxc+(n3-1)*r31)/(absc+(n3-1)*r32)*100;
end;
end;复制内容到剪贴板代码:
{周KDJ}
input:n(9,1,100),m1(3,2,40),m2(3,2,40);
wtj1:=datediff(ref(date,1),date)<>weekday-ref(weekday,1) or barpos=1;
wtj:=refx(wtj1,1); //周末标记
hn:=sumbars(wtj,n+1);
n0:=lbound(hn);
a:=setlbound(hn,1);
nn:=if(barpos<n0,barpos,hn-1);
RSV:=(CLOSE-LLV(LOW,nN))/(HHV(HIGH,nN)-LLV(LOW,nN))*100;
start:=barpos-barssince(wtj);
wk:=rsv[start[datacount]];
k[start[datacount]]:wk;
wd:=k[start[datacount]];
d[start[datacount]]:wd;
for i=start[datacount]+1 to datacount do begin
if wtj then begin
wk:=(rsv+(m1-1)*wk)/m1;
wd:=(wk+(m2-1)*wd)/m2;
k:=wk;
d:=wd;
end else begin
k:=(rsv+(m1-1)*wk)/m1;
d:=(k+(m2-1)*wd)/m2;
end;
end;
j:3*k-2*d;

{//验证代码:
drawicon(wtj,0,10);
zk:"kdj.k#week";
tt:count((round(zk*1000)-round(k*1000))*wtj,0);}因涉及到两大股软之间函数表达式的互换,感觉有必要重开新贴,以方便后来者。

以下是三个指标的大智慧版源码:

先上图

{周MACD}

INPUT:long(26,20,100),short(12,5,40),m(9,2,60);
VARIABLE:y=0,y1=0,dea=0;
wtj:=days1970-ref(days1970,1)<>weekday-ref(weekday,1) or barpos=1;
zm:=barslast(wtj)+1;
y:=(2*c+(short-1)*ref(y,zm))/(short+1);
y1:=(2*c+(long-1)*ref(y1,zm))/(long+1);
diff:y-y1;
dea:(2*diff+(m-1)*ref(dea,zm))/(m+1);
macd:2*(diff-dea),colorstick;

{//以下检查dea数据是否正确
weekdea:"macd.dea#week";
drawicon(wtj,0,10);
tt:count(FLOOR(weekdea*100000-dea*100000)*wtj,0);//每个周末的数据是否相同进行统计,精确小数点后5位。};

{周RSI}

input:n1(6),n2(12),n3(24);
variable:y11=0,y12=0,y21=0,y22=0,y31=0,y32=0;
REFLINE: 0, 20, 50, 80, 100;
wtj:=days1970-ref(days1970,1)<>weekday-ref(weekday,1) or barpos=1;
zm:=barslast(wtj)+1;
LC:=ref(close,zm);
y1:=max(close-LC,0);
y2:=abs(close-LC);
y11:=(y1+(n1-1)*ref(y11,zm))/n1;
y12:=(y2+(n1-1)*ref(y12,zm))/n1;
zrsi1:y11/y12*100;
y21:=(y1+(n2-1)*ref(y21,zm))/n2;
y22:=(y2+(n2-1)*ref(y22,zm))/n2;
zrsi2:y21/y22*100;
y31:=(y1+(n3-1)*ref(y31,zm))/n3;
y32:=(y2+(n3-1)*ref(y32,zm))/n3;
zrsi3:y31/y32*100;


{周KDJ}

input:n(9,1,100),m1(3,2,40),m2(3,2,40);
variable:k=0,d=0;
REFLINE: 0, 20, 50, 80, 100;
wtj1:=days1970-ref(days1970,1)<>weekday-ref(weekday,1) or barpos=1;
zm:=barslast(wtj1)+1;
wtj:="REFX@REFX"(wtj1,1); {周末标记}
nn:=sumbars(wtj,n+1)-1;
RSV:=(CLOSE-LLV(LOW,nn))/(HHV(HIGH,nn)-LLV(LOW,nn))*100;
k:if(barpos=1,rsv,(ref(k,zm)*(m1-1)+rsv)/m1);
d:if(barpos=1,k,(ref(d,zm)*(m2-1)+k)/m2);
j:3*k-2*d;

{//验证代码:
drawicon(wtj,0,10);
zk:"kdj.k#week";
tt:count((FLOOR(zk*1000)-FLOOR(k*1000))*wtj,0);};
 


 

上一篇:分时买卖带成交量源码  下一篇:捕捞季节
 ☟问题反馈 ☞┄┄┄┄┄┄┄┄┄┄→收藏资源:

无引用飞狐周MACD、周RSI、周KDJ 指标的大智慧表达式

  • 下载资源所需积分

    0

  • 当前拥有积分

    0

上传会员: 
股海网
文件大小: 
Bytes
上传时间: 
2011-04-26
下载积分: 
-
免责声明: 
请仔细阅读并同意后才能下载
本附件为用户分享上传,股海网没有对文件进行验证,不能保证下载资源的准确性、安全性和完整性,也不保证下载资源能正常安装和使用,且下载后扣除的积分无法退还,除非您充分理解并完全接受本声明,否则您无权下载。
本站对提供下载的软件、指标、资料等不拥有任何权利,其版权归该下载资源的合法拥有者所有。本附件仅供学习和研究使用,不得用于商业或者非法用途,如有侵犯您的版权, 请参看 《股海网侵权处理流程》《股海网免责声明条款》
点击下载无反应时,更换主流浏览器重新登录操作,如360浏览器、Edge浏览器、谷歌浏览器,个别浏览器有不兼容现象。
勾选以下表示您已经阅读并同意以上声明才能下载本文件,扣除积分无法退还!
我已阅读所有条款规定, 请点我同意 所有条款内容!我自愿下载!
提示:如下载失败,请点关闭刷新此页面或提交问题反馈给管理员→
关闭

关于我们 - 联系我们 - 隐私政策 - 免责声明 - 下载帮助 - 广告合作 - SiteMap - TOP
增值电信业务经营ICP许可证:湘B2-20210269 湘ICP备09016573号-10 湘公网安备43108102000040号
Copyright © 2021 铭网科技,All Rights Reserved.