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

金融证券系统

开发平台:

Others

  1. //------------------------------------------------------------------------------
  2. //
  3. //  Formula Name:    Volume Oscillator
  4. //  Author/Uploader: Steve Wiser 
  5. //  E-mail:          slwiserr@erols.com
  6. //  Date/Time Added: 2001-07-05 19:19:04
  7. //  Origin:          
  8. //  Keywords:        
  9. //  Level:           basic
  10. //  Flags:           system,exploration,indicator
  11. //  Formula URL:     http://www.amibroker.com/library/formula.php?id=61
  12. //  Details URL:     http://www.amibroker.com/library/detail.php?id=61
  13. //
  14. //------------------------------------------------------------------------------
  15. //
  16. //  Uses Volume oscillator to build a system test and indicator.
  17. //
  18. //------------------------------------------------------------------------------
  19. /* Volume Oscillator */
  20. /* Indicator, system, and exploration */
  21. /* Steve Wiser slwiserr@erols.com */
  22. PlusDM= IIf(HIGH>Ref(HIGH,-1) AND LOW>=Ref(LOW,-1), HIGH-Ref(HIGH,-1),
  23.                  IIf(HIGH>Ref(HIGH,-1) AND LOW<Ref(LOW,-1)
  24.                  AND HIGH-Ref(HIGH,-1)>Ref(LOW,-1)-LOW,
  25.                 HIGH-Ref(HIGH,-1),0));
  26. Vm=Log(EMa(V,3));
  27.  
  28. Buy= (C-L)*Vm+ (H-O)*Vm + 
  29.          IIf(C>O,(C-O)*Vm,0) + PlusDM*Vm + 
  30.          IIf(Ref(C,-1)<O,(O-Ref(C,-1))*Vm,0);
  31. MinDM = IIf(LOW<Ref(LOW,-1)   AND  HIGH<=Ref(HIGH,-1), Ref(LOW,-1)-LOW,
  32.                IIf(HIGH>Ref(HIGH,-1) AND LOW<Ref(LOW,-1)
  33.                AND HIGH-Ref(HIGH,-1)<Ref(LOW,-1)-LOW, Ref(LOW,-1)-LOW, 0));
  34. Sell= (H-C)*Vm + (O-L)*Vm + 
  35.          IIf(C<O,(O-C)*Vm,0) + MinDM*Vm + 
  36.          IIf(Ref(C,-1)>O,(Ref(C,-1)-O)*Vm,0);
  37. Wm=wilders(Wilders(buy,3)-Wilders(sell,3),3);
  38. Buy=cross(Wm,0);
  39. sell=cross(0,Wm);
  40.  
  41. Graph1=Wm;
  42. /*Graph2=Wilders(Wm,30);*/
  43. Graph2=ma(Wm,8);
  44. Graph0=0;
  45. Graph0Style=Graph1Style=Graph2Style=5;
  46. Graph2Color=6;
  47. Filter= (Buy==1)  ;
  48. numcolumns = 6;
  49. column0 =ref(C+0.065,-1);
  50. column0format = 1.2;
  51. column0name = "Trigger Price";WriteVal(C+0.065);
  52. column1 = C; 
  53. column1name = "Close       ";WriteVal(C);
  54. column1format = 1.2;
  55. column2 = ma(v,17); 
  56. column2name = "17 Ma Vol   ";WriteVal(ma(v,17) );
  57. column2format = 1.0;
  58. column3 = ma(C,17)/ma(c,50); 
  59. column3name = "% 17/50 ";WriteVal(  ma(C,17)/ma(c,50) );
  60. column3format = 1.2;
  61. column3format = 1.2;
  62. column4= ma(c,17);
  63. column4name="17 C ma"; WriteVal(  ma(c,17) );
  64. column4format = 1.2;
  65. column4= ma(c,50);
  66. column4name="50 C ma"; WriteVal( ma(c,50) );
  67. column4format = 1.2;
  68. Column5=Wm;
  69. column5Name="Vol Osc"; WriteVal(Wm);
  70. Column5Format=1.2;  
  71. /*  End of Exploration Code. */