MACD Histogram - Change in Direction.afl
上传用户:shiqiang
上传日期:2009-06-12
资源大小:1289k
文件大小:1k
源码类别:

金融证券系统

开发平台:

Others

  1. //------------------------------------------------------------------------------
  2. //
  3. //  Formula Name:    MACD Histogram - Change in Direction
  4. //  Author/Uploader: crash 
  5. //  E-mail:          crashandburn59@hotmail.com
  6. //  Date/Time Added: 2006-05-03 07:33:26
  7. //  Origin:          
  8. //  Keywords:        
  9. //  Level:           basic
  10. //  Flags:           indicator
  11. //  Formula URL:     http://www.amibroker.com/library/formula.php?id=618
  12. //  Details URL:     http://www.amibroker.com/library/detail.php?id=618
  13. //
  14. //------------------------------------------------------------------------------
  15. //
  16. //  This indicator shows the value of tomorrow's Closing Price in order for the
  17. //  slope of the MACD Histogram to change Direction. (ie. changing from a
  18. //  positive slope to a negative slope or changing from a negative slope to a
  19. //  positive slope)
  20. //
  21. //------------------------------------------------------------------------------
  22. _SECTION_BEGIN("MACD");
  23. GraphXSpace = 8;
  24. r1 = Param( "Fast avg", 12, 2, 200, 1 );
  25. r2 = Param( "Slow avg", 26, 2, 200, 1 );
  26. r3 = Param( "Signal avg", 9, 2, 200, 1 );
  27. mm = MACD(r1, r2);
  28. ms = Signal(r1, r2, r3);
  29. f1 = ((r3+1)*MM-2*MS)/(r3-1);
  30. f2 = EMA(C,r1)*(r1-1)/(r1+1);
  31. f3 = EMA(C,r2)*(r2-1)/(r2+1);
  32. f4 = 2/(r1+1) - 2/(r2+1);
  33. dcv = (f1-f2+f3)/ f4;
  34. Plot(dcv,"",4);
  35. PlotOHLC(O,H,L,C,"",1,styleCandle);
  36. Title = Name() + "  -  " + FullName() + "  -  " + Date() + "  -  Close = " + WriteVal(C,0.3) + "  -  DCV = " + WriteVal(dcv,0.3);
  37. _SECTION_END();