accumdist mov avg crossover SAR.afl
上传用户:shiqiang
上传日期:2009-06-12
资源大小:1289k
文件大小:1k
源码类别:

金融证券系统

开发平台:

Others

  1. //------------------------------------------------------------------------------
  2. //
  3. //  Formula Name:    accum/dist mov avg crossover SAR
  4. //  Author/Uploader: Jeff Parent 
  5. //  E-mail:          
  6. //  Date/Time Added: 2002-07-31 16:21:24
  7. //  Origin:          
  8. //  Keywords:        accumulation distribution volume SAR
  9. //  Level:           semi-advanced
  10. //  Flags:           indicator
  11. //  Formula URL:     http://www.amibroker.com/library/formula.php?id=209
  12. //  Details URL:     http://www.amibroker.com/library/detail.php?id=209
  13. //
  14. //------------------------------------------------------------------------------
  15. //
  16. //  Similar to a volume weighted price support/resistance line, uses the
  17. //  accumulation / distribution indicator to set stop line. vbscript required
  18. //  to calculate variable lookback period.
  19. //
  20. //------------------------------------------------------------------------------
  21. EnableScript("vbscript");
  22. <%
  23. function jMA(jH,jL,A2,A2m,k)
  24. dim result()
  25. redim result(UBound(jH))
  26. for i=k to UBound(jH)
  27. n=i+1
  28. if A2(i)<= A2m(i) then
  29. do until n=0
  30. n=n-1
  31. if A2(n)>= A2m(i) then exit do
  32. Loop
  33. result(i)=jH(n)
  34. else
  35. do until n=0
  36. n=n-1
  37. if A2(n)<= A2m(i) then exit do
  38. Loop 
  39. result(i)=jL(n)
  40. end if
  41. next
  42. jMA=result
  43. end function
  44. %>
  45. script=GetScriptObject();
  46. n=60;
  47. Graph0=script.jMA(H,L,AccDist(),EMA(AccDist(),n),n);
  48. Graph1=C;
  49. Graph1Style=128;
  50. Graph2=IIf(C<MA(C,n),MA(H,n),MA(L,n));Graph2Style=1;