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 LawrenHom, Today, 10:45 PM
          0 responses
          3 views
          0 likes
          Last Post LawrenHom  
          Started by love2code2trade, Yesterday, 01:45 PM
          4 responses
          28 views
          0 likes
          Last Post love2code2trade  
          Started by funk10101, Today, 09:43 PM
          0 responses
          7 views
          0 likes
          Last Post funk10101  
          Started by pkefal, 04-11-2024, 07:39 AM
          11 responses
          37 views
          0 likes
          Last Post jeronymite  
          Started by bill2023, Yesterday, 08:51 AM
          8 responses
          44 views
          0 likes
          Last Post bill2023  
          Working...
          X