苦苦寻找,求高手把飞狐周MACD改成通达信的,谢谢

[通达信] 3108 1
设置
2941814 Lv.4

专栏

发表于 2016-7-9 15:15 复制 显示全部楼层 正序浏览 |
跳转到指定楼层
呼求 @运七  
呼求 @周易2000  

源码:(原贴地址 http://55188.com/viewthread.php?tid=4169370)
飞狐
{周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;

[ 本帖最后由 芒果在中国 于 2016-7-10 03:44 编辑 ]
来自 广东省中山市

举报

使用道具 扔鸡蛋 回复

2941814
Lv.4

专栏

发表于 2016-7-9 15:27 复制 查看全部楼层 屏蔽
游客,您是(游客)级别,无法查看回复内容,请登录论坛并到新手区学习升级之后才能查看。升级指南请看...
来自 广东省中山市

举报

使用道具 点亮 支持 扔鸡蛋 回复

您需要登录后才可以回帖 登录

本版积分规则 《理想财富服务协议》《免责声明》

楼主
2楼
站长推荐 /8
回顶部 到页底
快速回复 返回顶部 返回列表