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

金融证券系统

开发平台:

Others

  1. //------------------------------------------------------------------------------
  2. //
  3. //  Formula Name:    Tom DeMark Trend Lines
  4. //  Author/Uploader: S M Jones 
  5. //  E-mail:          
  6. //  Date/Time Added: 2006-03-12 21:08:20
  7. //  Origin:          
  8. //  Keywords:        Trend Lines
  9. //  Level:           basic
  10. //  Flags:           indicator
  11. //  Formula URL:     http://www.amibroker.com/library/formula.php?id=597
  12. //  Details URL:     http://www.amibroker.com/library/detail.php?id=597
  13. //
  14. //------------------------------------------------------------------------------
  15. //
  16. //  Just include this code in your chart that has your HLOC graph and adjust
  17. //  the percent field and it will draw TD Trend Lines, in any time frame.
  18. //
  19. //  I started with the example code I found in the help section for
  20. //  "LineArray".
  21. //
  22. //------------------------------------------------------------------------------
  23. /*++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  24. THIS SECTION DRAWS TD TREND LINES */
  25. percent  = 0.01 * 1; /* Adjust this percent as necessary, I use .01 because FOREX is a 0.0000 number */
  26. firstpointL = 2;
  27. firstpointH = 2;
  28. y0=LastValue(Trough(L,percent,firstpointL)); 
  29. y1=LastValue(Trough(Ref(L,-1),percent,1));
  30. for( i = 1; i < BarCount AND y0 >= y1; i++ )
  31. {
  32. firstpointL++;
  33. y0=LastValue(Trough(L,percent,firstpointL));  
  34. }
  35. x0=BarCount - 1 - LastValue(TroughBars(L,percent,firstpointL)); 
  36. x1=BarCount - 1 - LastValue(TroughBars(Ref(L,-1),percent,1)); 
  37. LineL = LineArray( x0, y0, x1, y1, 1 ); 
  38. /*
  39. Plot(C, "C", colorBlack, styleCandle); 
  40. */
  41. Plot( LineL, " Support Trend line", colorWhite,4 +8 ); 
  42. yt0=LastValue(Peak(H,percent,firstpointH)); 
  43. yt1=LastValue(Peak(Ref(H,-1),percent,1));
  44. for(i = 1; i < BarCount AND yt0 <= yt1; i++ )
  45. {
  46. firstpointH++;
  47. yt0=LastValue(Peak(H,percent,firstpointH)); 
  48. }
  49. xt0=BarCount - 1 - LastValue(PeakBars(H,percent,firstpointH)); 
  50. xt1=BarCount - 1 - LastValue(PeakBars(Ref(H,-1),percent,1)); 
  51. LineH = LineArray( xt0, yt0, xt1, yt1, 1 ); 
  52. Plot( LineH, "Resistance Trend line", colorBrown,4 + 8 ); 
  53. /*+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++*/