Polarized Fractal Efficiency.afl
上传用户:shiqiang
上传日期:2009-06-12
资源大小:1289k
文件大小:1k
源码类别:

金融证券系统

开发平台:

Others

  1. //------------------------------------------------------------------------------
  2. //
  3. //  Formula Name:    Polarized Fractal Efficiency
  4. //  Author/Uploader: jparent 
  5. //  E-mail:          jparent@nobid.com
  6. //  Date/Time Added: 2002-02-24 22:15:45
  7. //  Origin:          
  8. //  Keywords:        
  9. //  Level:           medium
  10. //  Flags:           indicator
  11. //  Formula URL:     http://www.amibroker.com/library/formula.php?id=165
  12. //  Details URL:     http://www.amibroker.com/library/detail.php?id=165
  13. //
  14. //------------------------------------------------------------------------------
  15. //
  16. //  vbscript function to calculate PFE indicator for your array
  17. //
  18. //------------------------------------------------------------------------------
  19. EnableScript("vbscript");
  20. <%
  21. function PFE(V,n,s)
  22. dim result()
  23. redim result(UBound(V))
  24. for i=1 to n-1
  25. x=x+sqr((V(i)-V(i-1))^2+1)
  26. next
  27. for i=n to UBound(V)
  28. x=x+sqr((V(i)-V(i-1))^2+1)-sqr((V(i-n+1)-V(i-n))^2+1)
  29. sign=(V(i)<V(i-n+1))*2+1
  30. result(i)=100*sign*sqr((V(i)-V(i-n+1))^2+n^2)/x
  31. next
  32. smooth=2/(s+1)
  33. for i=n to UBound(V)
  34. result(i)=smooth*result(i)+(1-smooth)*result(i-1)
  35. next
  36. PFE=result
  37. end function
  38. %>
  39. script=GetScriptObject();
  40. Graph0=script.PFE(C,10,5);