ZeroLag MACD(p,q,r).afl
上传用户:shiqiang
上传日期:2009-06-12
资源大小:1289k
文件大小:2k
源码类别:

金融证券系统

开发平台:

Others

  1. //------------------------------------------------------------------------------
  2. //
  3. //  Formula Name:    ZeroLag MACD(p,q,r)
  4. //  Author/Uploader: Nand Kishor 
  5. //  E-mail:          nkishor@dccnet.com
  6. //  Date/Time Added: 2003-04-27 01:33:18
  7. //  Origin:          
  8. //  Keywords:        
  9. //  Level:           medium
  10. //  Flags:           indicator
  11. //  Formula URL:     http://www.amibroker.com/library/formula.php?id=273
  12. //  Details URL:     http://www.amibroker.com/library/detail.php?id=273
  13. //
  14. //------------------------------------------------------------------------------
  15. //
  16. //  Here is ZeroLag MACD(12,26,9). U can use the parameter
  17. //
  18. //  capability to tweak the periods. In comparison to AB's
  19. //
  20. //  built in MACD(12,26,9), ZeroLagMACD signals show up
  21. //
  22. //  a few days earlier, and divergences are quite pronounced.
  23. //
  24. //------------------------------------------------------------------------------
  25. /*Xero Lag MACD(p,q,r)*/
  26. //based on ZeroLag EMA - see Technical Analysis of Stocks and Commodities, April 2000
  27. p = Param("P",12,3,36,2);
  28. q = Param("Q",26,3,52,2);
  29. r = Param("R",9,3,15,1);
  30. EMA1= EMA(Close,p);
  31. EMA2= EMA(EMA1,p);
  32. Difference= EMA1 - EMA2;
  33. ZeroLagEMAp= EMA1 + Difference;
  34. //---------------------------------------
  35. EMA1= EMA(Close,q);
  36. EMA2= EMA(EMA1,q);
  37. Difference= EMA1 - EMA2;
  38. ZeroLagEMAq= EMA1 + Difference;
  39. //---------------------------------------
  40. ZeroLagMACD=ZeroLagEMAp - ZeroLagEMAq;
  41. //---------------------------------------
  42. // Signal line
  43. EMA1= EMA(ZeroLagMACD,r);
  44. EMA2= EMA(EMA1,r);
  45. Difference= EMA1 - EMA2;
  46. ZeroLagTRIG= EMA1 + Difference;
  47. Plot(zerolagMACD,"",5,4);
  48. Plot(zerolagtrig,"",7,4);
  49. //===========================end zeroLagMACD