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

金融证券系统

开发平台:

Others

  1. //------------------------------------------------------------------------------
  2. //
  3. //  Formula Name:    Time Left in Bar
  4. //  Author/Uploader: Ara Kaloustian 
  5. //  E-mail:          ara1@san.rr.com
  6. //  Date/Time Added: 2005-09-23 20:55:32
  7. //  Origin:          Ara Kaloustian
  8. //  Keywords:        Timenum,Time Counter
  9. //  Level:           medium
  10. //  Flags:           indicator
  11. //  Formula URL:     http://www.amibroker.com/library/formula.php?id=560
  12. //  Details URL:     http://www.amibroker.com/library/detail.php?id=560
  13. //
  14. //------------------------------------------------------------------------------
  15. //
  16. //  This code computes the amount of time left in a bar. To display you need to
  17. //  include "TimeLeft" variable in your chart title.
  18. //
  19. //  Code is designed for eSignal or similar data feed. Data feed uses exchange
  20. //  timestamp and must be synchronized with PC clock. See eSignal data manager
  21. //  for synchronizing option.
  22. //
  23. //------------------------------------------------------------------------------
  24. //File: TimeLeft in Bar
  25. //Sept 20, 2005
  26. // Compute Time Left In Bar
  27. //
  28. BarTime1   = LastValue(TimeNum() - Now(4));
  29. DataError  = iif(Now(4) > TimeNum(),True,False);
  30. TimeBase   = iif(Interval(1)>0,1,0);
  31. _N(StrBarTime = NumToStr(BarTime1,1.0,False));
  32. BT_Length     = StrLen(StrBarTime);
  33. _N(TimeLeft_    = Writeif(BT_Length==1,"0:0"+StrBarTime,Writeif(BT_Length==2,"0:"+StrBarTime,
  34.                  Writeif(BT_Length==3,StrLeft(StrBarTime,1)+":"+StrRight(StrBarTime,2),
  35.                    StrLeft(StrBarTime,2)+":"+StrRight(StrBarTime,2)))));
  36. TimeLeft   = writeif(TimeBase==1,TimeLeft_,"N/A");