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 fernandobr, Today, 09:11 AM
          0 responses
          0 views
          0 likes
          Last Post fernandobr  
          Started by itrader46, Today, 09:04 AM
          1 response
          3 views
          0 likes
          Last Post NinjaTrader_Clayton  
          Started by timmbbo, Today, 08:59 AM
          0 responses
          2 views
          0 likes
          Last Post timmbbo
          by timmbbo
           
          Started by bmartz, 03-12-2024, 06:12 AM
          5 responses
          33 views
          0 likes
          Last Post NinjaTrader_Zachary  
          Started by Aviram Y, Today, 05:29 AM
          4 responses
          14 views
          0 likes
          Last Post Aviram Y  
          Working...
          X