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

金融证券系统

开发平台:

Others

  1. //------------------------------------------------------------------------------
  2. //
  3. //  Formula Name:    Raw ADX
  4. //  Author/Uploader: Prakash Shenoi 
  5. //  E-mail:          
  6. //  Date/Time Added: 2006-09-19 08:18:17
  7. //  Origin:          MS formula conversion - Source: TASC Oct 1999 issue
  8. //  Keywords:        Trend Trading System
  9. //  Level:           basic
  10. //  Flags:           indicator
  11. //  Formula URL:     http://www.amibroker.com/library/formula.php?id=711
  12. //  Details URL:     http://www.amibroker.com/library/detail.php?id=711
  13. //
  14. //------------------------------------------------------------------------------
  15. //
  16. //  This ADX formula uses input variable for the periods and
  17. //
  18. //  uses Wilders and ATR in its calculation.
  19. //
  20. //------------------------------------------------------------------------------
  21. /* ADX Raw  */
  22. //Afl code - Prakash Shenoi //
  23. TP= Param("Time Periods",14,1,50);
  24. PlusDM= IIf(High>Ref(High,-1) AND
  25. Low>=Ref(Low,-1), High-Ref(High,-1),
  26. IIf(High>Ref(High,-1) AND Low<Ref(Low,-1)
  27. AND High-Ref(High,-1)>Ref(Low,-1)-Low,
  28. High-Ref(High,-1), 0));
  29. DIPlus= 100 * Wilders(PlusDM,TP) /
  30. ATR(TP);
  31. MinusDM= IIf(Low<Ref(Low,-1) AND
  32. High<=Ref(High,-1), Ref(Low,-1)-Low,
  33. IIf(High>Ref(High,-1) AND Low<Ref(Low,-1)
  34. AND High-Ref(High,-1)<Ref(Low,-1)-Low,
  35. Ref(Low,-1)-Low, 0));
  36. DIMinus = 100 * Wilders(MinusDM,TP) /
  37. ATR(TP);
  38. Diff= abs(DIPlus - DIMinus);
  39. DISum= DIPlus + DIMinus;
  40. ADXRaw= 100 * Wilders(Diff/DISum, TP);
  41. Plot (ADXRaw,"ADXRaw",1,styleThick);
  42. //Plot (DiPlus,"DI+", 3,1);
  43. //Plot (DiMinus,"DI-",4,1);
  44. GraphXSpace=4;