根据价格运动效率自适应调节加权系数, 比固定周期的均线更适合于趋势跟踪.
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; |
|