Announcement

Collapse

Looking for a User App or Add-On built by the NinjaTrader community?

Visit NinjaTrader EcoSystem and our free User App Share!

Have a question for the NinjaScript developer community? Open a new thread in our NinjaScript File Sharing Discussion Forum!
See more
See less

Partner 728x90

Collapse

Calculating Time in Volume Bars

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

    Calculating Time in Volume Bars

    I am using volume bars and need to calculate how long is current bar being printed in real time. One way is to calculate is to do it manually by substrcting start time of bar from curren time. But is there a method or system variable that already doing this?

    Thanks,
    redduke

    #2
    - there is no support for start time of a bar
    - I would calculate the difference between the time stamps of the current and the previous bar like (pseudo code)
    Code:
    if (CurrentBar < 2)
        return;
    double difference = Time[0].Subtract(Time[1]).TotalMilliseconds;

    Comment


      #3
      Thanks Dierk,

      I meant to say End of a bar. I thought that I would need to calculate the difference, but just wanted to double check.

      Regards,
      redduke

      Comment


        #4
        TotalMilliseconds Resolution

        I have tried to display bar timestamps in Milliseconds and calculate TotalMilliseconds for elapased time between bars but the values returned are always in seconds. Is this a data vendor restriction? I am using Zen-Fire. Are there any vendors that timestamp their data in Milliseconds and if so who are they? Thanks.

        Comment


          #5
          >> Are there any vendors that timestamp their data in Milliseconds and if so who are they?
          Not that I know of.

          Comment

          Latest Posts

          Collapse

          Topics Statistics Last Post
          Started by zstheorist, Today, 07:52 PM
          0 responses
          6 views
          0 likes
          Last Post zstheorist  
          Started by pmachiraju, 11-01-2023, 04:46 AM
          8 responses
          150 views
          0 likes
          Last Post rehmans
          by rehmans
           
          Started by mattbsea, Today, 05:44 PM
          0 responses
          6 views
          0 likes
          Last Post mattbsea  
          Started by RideMe, 04-07-2024, 04:54 PM
          6 responses
          33 views
          0 likes
          Last Post RideMe
          by RideMe
           
          Started by tkaboris, Today, 05:13 PM
          0 responses
          6 views
          0 likes
          Last Post tkaboris  
          Working...
          X