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

金融证券系统

开发平台:

Others

  1. //------------------------------------------------------------------------------
  2. //
  3. //  Formula Name:    Pivot Points
  4. //  Author/Uploader: Avi ben a 
  5. //  E-mail:          avi111a@yahoo.com
  6. //  Date/Time Added: 2006-10-07 03:01:12
  7. //  Origin:          
  8. //  Keywords:        
  9. //  Level:           basic
  10. //  Flags:           indicator
  11. //  Formula URL:     http://www.amibroker.com/library/formula.php?id=734
  12. //  Details URL:     http://www.amibroker.com/library/detail.php?id=734
  13. //
  14. //------------------------------------------------------------------------------
  15. //
  16. //  Pivot points for EOD,week, month.
  17. //
  18. //  very nice tool i use for support and resistence.
  19. //
  20. //  enjoy!
  21. //
  22. //------------------------------------------------------------------------------
  23. /***************************************/
  24. /*PIVOT POINTS ver 1.1 written by Avi b*/
  25. /***************************************/
  26. // please note: i use the current value for the NEXT DAY
  27. h1= SelectedValue (Ref(H,0) );
  28. l1= SelectedValue (Ref(L,0) );
  29. c1= SelectedValue (Ref(C,0) );
  30. // PIVOT Calculation
  31. p = ( H1+ L1 + C1 )/3;
  32. s1 = (2*p)-H1;
  33. r1 = (2*p)-L1;
  34. s2 = p -(H1 - L1);
  35. s3 = S1 - (H1-L1); 
  36. r2 = p +(H1 - L1);
  37. r3 = R1 +(H1-L1);
  38. // PIVOT mid points
  39. MIDR1 = (P+R1)/2;
  40. MIDR2 = (R1+R2)/2;
  41. MIDR3 = (R2+R3)/2;
  42. MIDS1 = (P+S1)/2;
  43. MIDS2 = (S1+S2)/2;
  44. MIDS3 = (S2+S3)/2;
  45. // Graphs & values plot
  46. Plot (p,"Pivot",25,1);
  47. Plot (r1,"R1",12,1);
  48. Plot (r2,"R2",12,1);
  49. Plot (r3,"R3",12,1);
  50. Plot (s1,"S1",3,1);
  51. Plot (s2,"S2",3,1);
  52. Plot (s3,"S3",3,1);
  53. /*
  54. Plot (MIDR1,"midr1",12,32);
  55. Plot (MIDR2,"midr2",12,32);
  56. Plot (MIDR3,"midr3",12,32);
  57. Plot (MIDS1,"mids1",12,32);
  58. Plot (MIDS2,"mids2",12,32);
  59. Plot (MIDS3,"mids3",12,32);
  60. */
  61. Plot (C,"Close",16,64);
  62. // side might be ajusted depends on data array
  63. Hight =33;
  64. side = Param("side",73,0,1000,1);
  65. for( i = 0; i < BarCount; i++ ) 
  66. {
  67.  if(i+side== BarCount) PlotText( "Pivot = "+P, i+Hight,P, colorGreen );
  68.  if(i+side== BarCount) PlotText( "R1 = "+R1, i+Hight,R1, 12 );
  69.  if(i+side== BarCount) PlotText( "R2 = "+R2, i+Hight,R2, 12 );
  70.  if(i+side== BarCount) PlotText( "R3 = "+R3, i+Hight,R3, 12 );
  71.  if(i+side== BarCount) PlotText( "S1 = "+S1, i+Hight,S1, 3);
  72.  if(i+side== BarCount) PlotText( "S2 = "+S2, i+Hight,S2, 3 );
  73.  if(i+side== BarCount) PlotText( "S3 = "+S3, i+Hight,S3, 3 );
  74. }
  75. // text section
  76. "HIGH /LOW /CLOSE = " +H +" / "+ L+" / "+ C +"n";
  77. "H1 /L1 /C1 = " +H1 +" / "+ L1+" / "+ C1 +"n";
  78. "R3 = " +R3;
  79. "midr3 = " +MIDR3;
  80. "R2 = " +R2;
  81. "midr2 = " +MIDR2;
  82. "R1 = " +R1;
  83. "midr1 = " +MIDR1;
  84. "*************";
  85. "p = " +p;
  86. "*************";
  87. "mids1 = " +MIDS1;
  88. "S1 = " +S1;
  89. "mids2 = " +MIDS2;
  90. "S2 = " +S2;
  91. "mids3 = " +MIDS3;
  92. "S3 = " +S3;