分享

考夫曼自适应均线

 yzy666 2017-12-25
根据价格运动效率自适应调节加权系数, 比固定周期的均线更适合于趋势跟踪.

input:n1(8);
n:=if(barpos<=n1,barpos-1,n1);
direction:=c-ref(c,n);
volatility:=sum(abs(c-ref(c,1)),n);
ER:=direction/volatility;
smooth:=if(barpos=1,1,ER*0.6022+0.0645);
cc:=smooth*smooth;
ama:dma(c,cc);
 
 
发现设置2条考夫曼自适应均线时,改变其中一条均线的参数时,另外的一条均线也会跟着改变的(这条的参数没有变动过)
不知是怎样回事,会影响其它均线的值?
input:n1(8);
n:=if(barpos<=n1,barpos-1,n1);
direction:=c-ref(c,n);
volatility:=sum(abs(c-ref(c,1)),n);
ER:=direction/volatility;
smooth:=if(barpos=1,1,ER*0.6022+0.0645);
cc:=smooth*smooth;
ama:dma(c,cc),LINETHICK0;
PARTLINE(ama>=ref(ama,1),ama),COLORRED,LINETHICK2;
PARTLINE(ama<ref(ama,1),ama),COLORWHITE,LINETHICK2;
input:n2(30);{改变其值时,上面的AMA均线值也会变}
nn:=if(barpos<=n2,barpos-1,n2);
direction1:=c-ref(c,nn);
volatility1:=sum(abs(c-ref(c,1)),n);
ER1:=direction1/volatility1;
smooth1:=if(barpos=1,1,ER1*0.6022+0.0645);
cc1:=smooth1*smooth1;
ama1:dma(c,cc1),LINETHICK0;
PARTLINE(ama1>=ref(ama1,1),ama1),COLORMAGENTA,LINETHICK2;
PARTLINE(ama1<ref(ama1,1),ama1),COLORBLUE,LINETHICK2;

    本站是提供个人知识管理的网络存储空间,所有内容均由用户发布,不代表本站观点。请注意甄别内容中的联系方式、诱导购买等信息,谨防诈骗。如发现有害或侵权内容,请点击一键举报。
    转藏 分享 献花(0

    0条评论

    发表

    请遵守用户 评论公约

    类似文章 更多