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 geddyisodin, Today, 05:20 AM
          2 responses
          16 views
          0 likes
          Last Post geddyisodin  
          Started by hazylizard, Today, 08:38 AM
          0 responses
          6 views
          0 likes
          Last Post hazylizard  
          Started by Max238, Today, 01:28 AM
          5 responses
          43 views
          0 likes
          Last Post Max238
          by Max238
           
          Started by giulyko00, Yesterday, 12:03 PM
          3 responses
          13 views
          0 likes
          Last Post NinjaTrader_BrandonH  
          Started by habeebft, Today, 07:27 AM
          1 response
          16 views
          0 likes
          Last Post NinjaTrader_ChristopherS  
          Working...
          X