Log Time Scale.afl
上传用户:shiqiang
上传日期:2009-06-12
资源大小:1289k
文件大小:1k
源码类别:

金融证券系统

开发平台:

Others

  1. //------------------------------------------------------------------------------
  2. //
  3. //  Formula Name:    Log Time Scale
  4. //  Author/Uploader: Jeff Parent 
  5. //  E-mail:          
  6. //  Date/Time Added: 2004-04-23 10:03:05
  7. //  Origin:          
  8. //  Keywords:        
  9. //  Level:           medium
  10. //  Flags:           function
  11. //  Formula URL:     http://www.amibroker.com/library/formula.php?id=354
  12. //  Details URL:     http://www.amibroker.com/library/detail.php?id=354
  13. //
  14. //------------------------------------------------------------------------------
  15. //
  16. //  Uses Param feature to adjust increaasing time compression as chart moves
  17. //  back in time. A bit like looking at multiple time frame charts, except its
  18. //  all in one chart.
  19. //
  20. //------------------------------------------------------------------------------
  21. //Log Time
  22. s=Param("speed",0,0,0.04,0.0001);
  23. b=BarCount-1;
  24. bc=b;
  25. Hy=Null;Ly=Null;Oy=Null;Cy=Null;
  26. do
  27. {
  28. Hx=0;Lx=1000000;
  29. Cy[bc]=C[b];
  30. f=int(exp(s*(BarCount-bc+1)));
  31. b1=b-f;
  32. while (b>b1 AND b>-1)
  33. {
  34. if (H[b]>Hx) Hx=H[b];
  35. if (L[b]<Lx) Lx=L[b];
  36. b--;
  37. }
  38. Hy[bc]=Hx;Ly[bc]=Lx;Oy[bc]=O[b+1];
  39. bc--;
  40. } while (b>-1);
  41. PlotOHLC(Oy,Hy,Ly,Cy,"",1,styleCandle);
  42. Plot(Oy,"open",1,styleNoDraw);
  43. Plot(Hy,"hi",1,styleNoDraw);
  44. Plot(Ly,"lo",1,styleNoDraw);
  45. Plot(Cy,"close",1,styleNoDraw);