Performance Overview.afl
上传用户:shiqiang
上传日期:2009-06-12
资源大小:1289k
文件大小:3k
源码类别:

金融证券系统

开发平台:

Others

  1. //------------------------------------------------------------------------------
  2. //
  3. //  Formula Name:    Performance Overview
  4. //  Author/Uploader: Thomas Zmuck 
  5. //  E-mail:          thomas.zm@aon.at
  6. //  Date/Time Added: 2002-08-24 08:32:35
  7. //  Origin:          
  8. //  Keywords:        Performance View
  9. //  Level:           advanced
  10. //  Flags:           indicator
  11. //  Formula URL:     http://www.amibroker.com/library/formula.php?id=216
  12. //  Details URL:     http://www.amibroker.com/library/detail.php?id=216
  13. //
  14. //------------------------------------------------------------------------------
  15. //
  16. //  This formula is for indicator builder and shows you the performance from 4
  17. //  user-defined tickers or indices and the current ticker.
  18. //
  19. //  0% is always on the first visible bar over the zoomed area. You can also
  20. //  scroll the chart, 0% is always on the left.
  21. //
  22. //  Activate Percent in Indicator builder and select Level 0
  23. //
  24. //  Note: It requires the gaussian DLL for smoothing, but you can also change
  25. //  in every line: gauss2ord to MA or any other moving, but i think gauss2ord
  26. //  smoothing much better than ma or ema or anything else.
  27. //
  28. //  The gauss2ord plugin is available here:
  29. //
  30. //  http://groups.yahoo.com/group/amibroker/files/PLUGIN%20DLL/Gaussian.dll
  31. //
  32. //  Save it in amibroker/plugin folder and restart AB or go Plugins and Load
  33. //  again.
  34. //
  35. //------------------------------------------------------------------------------
  36. //Performance Overview
  37. //written: 23-Aug.2002
  38. //Thomas Zmuck
  39. //thomas.zm@aon.at
  40. pds=5; //select 1, if you want no smoothing, you can also use ma or ema instead Gauss2ord, but i find gauss2ord better.
  41. T1_mov = Gauss2ord(Foreign("^ixic","close"),pds);//blue Line
  42. T2_mov = Gauss2ord(Foreign("^iix","close"),pds);//green Line
  43. T3_mov = Gauss2ord(Foreign("^btk","close"),pds);//black Line
  44. T4_mov = Gauss2ord(Foreign("^soxx","close"),pds);//orange Line
  45. T5_mov = Gauss2ord(C,pds);//you can select here also 1 to have the current ticker unsmoothed
  46. T1=T1_mov;  T2=T2_mov;  T3=T3_mov;  T4=T4_mov;  T5=T5_mov;
  47. barvisible = Status("barvisible");
  48. FVB = barvisible AND NOT
  49. Ref(barvisible,-1);
  50. FVB_T1= ValueWhen(FVB==1,T1);
  51. FVB_T2= ValueWhen(FVB==1,T2);
  52. FVB_T3= ValueWhen(FVB==1,T3);
  53. FVB_T4= ValueWhen(FVB==1,T4);
  54. FVB_T5= ValueWhen(FVB==1,T5);
  55. First_T1_OV = ValueWhen(Cum(1)==1,T1);
  56. First_T2_OV = ValueWhen(Cum(1)==1,T2);
  57. First_T3_OV = ValueWhen(Cum(1)==1,T3);
  58. First_T4_OV = ValueWhen(Cum(1)==1,T4);
  59. First_T5_OV = ValueWhen(Cum(1)==1,T5);
  60. Perf_T1= IIf(IsEmpty(FVB_T5),100*(T1/First_T1_OV)-100,100*(T1/FVB_T1)-100);
  61. Perf_T2= IIf(IsEmpty(FVB_T5),100*(T2/First_T2_OV)-100,100*(T2/FVB_T2)-100);
  62. Perf_T3= IIf(IsEmpty(FVB_T5),100*(T3/First_T3_OV)-100,100*(T3/FVB_T3)-100);
  63. Perf_T4= IIf(IsEmpty(FVB_T5),100*(T4/First_T4_OV)-100,100*(T4/FVB_T4)-100);
  64. Perf_T5= IIf(IsEmpty(FVB_T5),100*(T5/First_T5_OV)-100,100*(T5/FVB_T5)-100); 
  65. Plot(Perf_T1,"",colorBlue,1);
  66. Plot(Perf_T2,"",colorGreen,1);
  67. Plot(Perf_T3,"",colorBlack,1);
  68. Plot(Perf_T4,"",colorOrange,1);
  69. Plot(Perf_T5,"",colorRed,1);
  70. Title= "Performance Overview       Smooth-Factor:"+WriteVal(pds,1.0)+"         "+"blue:   ^IXIC "+WriteVal(Perf_T1,1.2)+" %          "+
  71. "green:   ^IIX "+WriteVal(Perf_T2,1.2)+" %          "+
  72. "black:   ^BTK "+WriteVal(Perf_T3,1.2)+" %          "+
  73. "orange:   ^SOXX "+WriteVal(Perf_T4,1.2)+" %          red:   "+
  74. FullName()+"   " + WriteVal(Perf_T5,1.2)+" %";
  75. GraphXSpace = 2;