Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

How to check for Time being valid?

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    How to check for Time being valid?

    How should I check to see whether Time is valid before trying to access it?
    • Time is often non-null, but still invalid, so that does not work
    • Time.Count throws if accessed before Time is valid. Technically one could do a try...catch, but that is not really a very satisfactory method
    • I know from the debugger that Time is sometimes valid and sometimes NULL when State >=State.Historical. I do not like a state-based method anyway, because it is subject to breaking in the future if the implementation changes
    • ISeries supports IsValidDataPoint(0), but unfortunately TimeSeries does not

    What I am really looking for is a way to directly test whether or not Time is yet valid. Any suggestions will be appreciated.

    Thanks,
    --EV
    Last edited by ETFVoyageur; 08-05-2015, 03:46 AM.

    #2
    If you're talking about the TimeSeries associated with data bars, as long as CurrentBar != -1, the value of the Time[0] should be set.

    Code:
    if(CurrentBar != -1)
         Print(Time[0]);
    MatthewNinjaTrader Product Management

    Comment


      #3
      Originally posted by ETFVoyageur View Post
      How should I check to see whether Time is valid before trying to access it?
      • Time is often non-null, but still invalid, so that does not work
      • Time.Count throws if accessed before Time is valid. Technically one could do a try...catch, but that is not really a very satisfactory method
      • I know from the debugger that Time is sometimes valid and sometimes NULL when State >=State.Historical. I do not like a state-based method anyway, because it is subject to breaking in the future if the implementation changes
      • ISeries supports IsValidDataPoint(0), but unfortunately TimeSeries does not

      What I am really looking for is a way to directly test whether or not Time is yet valid. Any suggestions will be appreciated.

      Thanks,
      --EV
      Time of "what"? And how do you mean "valid"? What is the determinant of validity? A time is a time.

      Comment

      Latest Posts

      Collapse

      Topics Statistics Last Post
      Started by Geovanny Suaza, 02-11-2026, 06:32 PM
      0 responses
      668 views
      0 likes
      Last Post Geovanny Suaza  
      Started by Geovanny Suaza, 02-11-2026, 05:51 PM
      0 responses
      377 views
      1 like
      Last Post Geovanny Suaza  
      Started by Mindset, 02-09-2026, 11:44 AM
      0 responses
      110 views
      0 likes
      Last Post Mindset
      by Mindset
       
      Started by Geovanny Suaza, 02-02-2026, 12:30 PM
      0 responses
      575 views
      1 like
      Last Post Geovanny Suaza  
      Started by RFrosty, 01-28-2026, 06:49 PM
      0 responses
      580 views
      1 like
      Last Post RFrosty
      by RFrosty
       
      Working...
      X