RSI of Weekly Price Array.afl
上传用户:shiqiang
上传日期:2009-06-12
资源大小:1289k
文件大小:2k
源码类别:

金融证券系统

开发平台:

Others

  1. //------------------------------------------------------------------------------
  2. //
  3. //  Formula Name:    RSI of Weekly Price Array
  4. //  Author/Uploader: Anthony Faragasso 
  5. //  E-mail:          ajf1111@epix.net
  6. //  Date/Time Added: 2002-09-21 20:27:56
  7. //  Origin:          
  8. //  Keywords:        
  9. //  Level:           medium
  10. //  Flags:           indicator
  11. //  Formula URL:     http://www.amibroker.com/library/formula.php?id=226
  12. //  Details URL:     http://www.amibroker.com/library/detail.php?id=226
  13. //
  14. //------------------------------------------------------------------------------
  15. //
  16. //  Plot the RSI of Weekly Price Arrays,Enter ( t ) variable in
  17. //
  18. //  Multiples of 5 for weekly.
  19. //
  20. //------------------------------------------------------------------------------
  21. //RSI of Weekly Price Array
  22. //Coded by Anthony Faragasso
  23. //Ver. 1.01 Update#1
  24. //Credit to Tomasz for some code help
  25.  
  26. weekstart = DayOfWeek() < Ref( DayOfWeek(), -1 );
  27. weekend = DayOfWeek() > Ref( DayOfWeek(),1);
  28. /****** Weekly Values ***************/
  29. WeeklyOpen=ValueWhen(DayOfWeek()< Ref(DayOfWeek(),-1) ,Open);
  30. WeeklyHigh = ValueWhen( weekend, HighestSince( weekstart, High ) );
  31. WeeklyLow = ValueWhen( weekend, LowestSince( weekstart, Low ) );
  32. WeeklyClose=ValueWhen(DayOfWeek() > Ref( DayOfWeek(),1),Close);
  33. WeeklyVolume=ValueWhen(DayOfWeek() > Ref(DayOfWeek(),1),Sum(V,5));
  34. /***********************************/
  35. /*N-Day RSI of Weekly Price array*/
  36. /*Variable Identifiers*/
  37. A1=weeklyclose;
  38. b2=weeklyHigh;
  39. C3=weeklylow;
  40. D4=weeklyopen;
  41. e5=weeklyvolume;
  42. t=15;// Set Time in Multiples of 5 for weekly 
  43. Var=A1;//Insert Variable Identifier from Above
  44. Up=IIf(Var>Ref(Var,-1),abs(Var-Ref(Var,-1)),0); 
  45. Dn=IIf(Var<Ref(Var,-1),abs(Var-Ref(Var,-1)),0); 
  46. Ut=Wilders(Up,t); 
  47. Dt=Wilders(Dn,t); 
  48. RSIWeekly=100*(Ut/(Ut+Dt)); 
  49. Graph0=RSIweekly;
  50. Graph0Style=1;
  51. Title=Name()+"..."+" "+"("+WriteVal(t,1)+" )"+"...RSI_Weekly Of..."+EncodeColor(colorRed)+WriteIf(Var==A1,"WeeklyClose",WriteIf(Var==b2,"WeeklyHigh",WriteIf(Var==C3,"WeeklyLow",WriteIf(Var==d4,"WeeklyOpen",WriteIf(Var==e5,"WeeklyVolume","")))))+EncodeColor(colorBlack)+""+" = "+"(" +WriteVal(RSIweekly,1.2)+")"+"%";