Time Frame Weekly Bars.afl
上传用户:shiqiang
上传日期:2009-06-12
资源大小:1289k
文件大小:2k
源码类别:

金融证券系统

开发平台:

Others

  1. //------------------------------------------------------------------------------
  2. //
  3. //  Formula Name:    Time Frame Weekly Bars
  4. //  Author/Uploader: Anthony Faragasso 
  5. //  E-mail:          ajf1111@epix.net
  6. //  Date/Time Added: 2002-09-21 19:57:33
  7. //  Origin:          
  8. //  Keywords:        
  9. //  Level:           medium
  10. //  Flags:           indicator
  11. //  Formula URL:     http://www.amibroker.com/library/formula.php?id=223
  12. //  Details URL:     http://www.amibroker.com/library/detail.php?id=223
  13. //
  14. //------------------------------------------------------------------------------
  15. //
  16. //  WEEKLY PRICE ARRAY : The close is the close of the last day of the week:
  17. //
  18. //  (WeeklyClose) The open is the open of the first day of the week:
  19. //  (WeeklyOpen) The high is
  20. //
  21. //  the highest high of the week : (WeeklyHigh) The low is the lowest low of
  22. //  the week :
  23. //
  24. //  (WeeklyLow ) The volume is the sum of the volume for the Week.
  25. //
  26. //------------------------------------------------------------------------------
  27. //Time Frame Weekly Bars
  28. //Coded by Anthony Faragasso
  29. //Ver. 1.01, Update#1
  30. //Credit to Tomasz for some Help 
  31. weekstart = DayOfWeek() < Ref( DayOfWeek(), -1 );
  32. weekend = DayOfWeek() > Ref( DayOfWeek(),1);
  33. /**Establish weekly Price Arrays**/
  34. WeeklyOpen=ValueWhen(DayOfWeek()< Ref(DayOfWeek(),-1) ,Open);
  35. WeeklyHigh = ValueWhen( weekend, HighestSince( weekstart, High ) );
  36. WeeklyLow = ValueWhen( weekend, LowestSince( weekstart, Low ) );
  37. WeeklyClose=ValueWhen(DayOfWeek() > Ref( DayOfWeek(),1),Close);
  38. WeeklyVolume=ValueWhen(DayOfWeek() > Ref(DayOfWeek(),1),Sum(V,5));
  39. Plot(WEEKLYHIGH,"WkHIGH",colorRed,styleLine);
  40. Plot(WEEKLYLOW,"WkLOW",colorGreen,styleLine);
  41. Plot(WEEKLYOPEN,"WkOPEN",colorBlue,styleLine);
  42. Plot(WEEKLYCLOSE,"WkCLOSE",colorYellow,styleLine);
  43. Plot(Close,"CLOSE",colorBlack,styleCandle);
  44. //Plot(weeklyvolume,"WkVOL",colorOrange,styleLine);