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

Time Value of Range Bar

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

    Time Value of Range Bar

    Does anybody know of an indicator that calculates the total time it takes a range bar to complete.

    I would like to use it as a volatility indicator - the faster the bar closes demonstrates increasing volatility.


    If this indicator is not available what would be the command/function that would return the value of the difference of range bar open and range bar close.

    I met a trader some years ago who had this indicator which displayed the time value as a histogram.

    Thank you

    Stefan

    #2
    Hello sdauteuil,

    Thanks for your post.

    I've attached a simple indicator that will provide bar times in seconds, this is the code: BarTime[0] = (Time[0] - Time[1]).TotalSeconds;

    It provides a histogram type display, works on any bar type (although time based bars would be redundant).

    BarTimes.zip
    Paul H.NinjaTrader Customer Service

    Comment


      #3
      Thank you that is quite helpful.

      Is this the difference between the current bar open time and the current bar time or previous bars close and current bar time?

      Comment


        #4
        Hello Stefan,

        Thanks for your reply.

        When looking at historical data, it is from the close time of the currently evaluated bar to the previous bars close time.

        In live data,:

        If the calculate mode is set to Calculate.OnBarClose, it would be the same as historical , IE: the time from the just closed bar to the previous bar close.
        If the calculate mode is changed to OnEachTick or OnPriceChange, then it would be the time from the just closed bar to the current bar (forming bar).
        OnPriceChange may skip some time if the ticks come in at the same price, OnEachTick will update as a tick comes in and this would be the fastest OnBarUpdate() mode.
        Paul H.NinjaTrader Customer Service

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by pechtri, 06-22-2023, 02:31 AM
        10 responses
        124 views
        0 likes
        Last Post Leeroy_Jenkins  
        Started by judysamnt7, 03-13-2023, 09:11 AM
        4 responses
        59 views
        0 likes
        Last Post DynamicTest  
        Started by ScottWalsh, Yesterday, 06:52 PM
        4 responses
        36 views
        0 likes
        Last Post ScottWalsh  
        Started by olisav57, Yesterday, 07:39 PM
        0 responses
        7 views
        0 likes
        Last Post olisav57  
        Started by trilliantrader, Yesterday, 03:01 PM
        2 responses
        22 views
        0 likes
        Last Post helpwanted  
        Working...
        X