Distance Coefficient Ehlers Filter.afl
上传用户:shiqiang
上传日期:2009-06-12
资源大小:1289k
文件大小:1k
源码类别:

金融证券系统

开发平台:

Others

  1. //------------------------------------------------------------------------------
  2. //
  3. //  Formula Name:    Distance Coefficient Ehlers Filter
  4. //  Author/Uploader: Chris Yeoh 
  5. //  E-mail:          turkey@kingdomwork.net
  6. //  Date/Time Added: 2004-11-14 23:50:02
  7. //  Origin:          TASC April 2001
  8. //  Keywords:        
  9. //  Level:           medium
  10. //  Flags:           indicator
  11. //  Formula URL:     http://www.amibroker.com/library/formula.php?id=402
  12. //  Details URL:     http://www.amibroker.com/library/detail.php?id=402
  13. //
  14. //------------------------------------------------------------------------------
  15. //
  16. //  Taken from the article in TASC's April 2001 Issue.
  17. //
  18. //------------------------------------------------------------------------------
  19. Price = (H+L)/2;
  20. CoefLookback = 5;
  21. Coef = (Price-Ref(Price, -1))^2+(Price-Ref(Price, -2))^2+(Price-Ref(Price, -3))^2+(Price-Ref(Price, -4))^2+(Price-Ref(Price, -5))^2;
  22. SumCoef=0;
  23. SumCoefPrice=0;
  24. for(i=0; i < CoefLookback; i++) {
  25. SumCoef = SumCoef + Ref(Coef, -i);
  26. SumCoefPrice = SumCoefPrice + (Ref(Coef, -i) * Ref(Price, -i));
  27. }
  28. DCEF = SumCoefPrice / SumCoef;
  29. Plot(Close, "Close", colorBlack, styleLine);
  30. Plot(DCEF, "NonLinear Ehlers Filter", IIf(Close>DCEF, colorGreen, colorRed), styleLine);