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

Tic Based Bars

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

    Tic Based Bars

    My question has to do with range bars. Let's say I have a 15 tic range bar chart and the current bar being built is 14 tics from the low to the high - the current market is at the high. One more price increment up, and I have a full range bar, but what happens if the tic that comes in next is 2 or more price increments above the Last tic - effectively starting a new bar?

    I am assuming this new tic (gap) would have incremented CurrentBar and all values in data series such as Low[0], High[0] and Close[0] would all be referencing the now current bar. However, what will High[1] value be since there was really only 14 price increments in the bar? Would High-Low equal 14 tics or 15 tics?

    Also, how would this scenario change (or not) when switching between Range and RangeAlt?


    Thanks in advance…

    -Scott
    Last edited by CashCache; 09-08-2008, 09:13 PM.

    #2
    Hi Scott,

    The old bar will be the maximum range of 15 ticks and then the new bar will just be built as you expect. I believe both Range and RangeAlt will behave the same way.
    Josh P.NinjaTrader Customer Service

    Comment


      #3
      Josh,

      So, if we do gap up like I described in my initial post, will I get an OnBarUpdate() event for the 15th (last) tic of the bar even though it gapped over the price?

      I am using CalculateOnBarClose = false;

      Thanks,

      -Scott

      Comment


        #4
        I believe you will get the event for the new bar. It should be a single event and will not be split into part old bar part new bar.
        Josh P.NinjaTrader Customer Service

        Comment


          #5
          I'm getting odd results. I am sure I can find a way to work around them, but I'd like to make sure the behavior I am seeing is expected.

          I am using 5 tic range bars. I am processing OnBarUpdate() on every tic. I am looking for High[0]-Low[0] to equal a five tic difference (doing the math on the tic size and so on). As soon as we have a full range bar, I then print out the following:

          Bars[0]
          High[0]
          Low[0]
          Close[0]

          The High and Low are always 5 tics different - which I would expect, but I would also expect the Close to be equal to either the High or the Low, but it is not alwasy. Sometimes it is still someplace in the middle of the bar.

          Why is that? Does the Close not actually get set until the next bar starts?


          The second question: I am processing every tic. If a range bar formed from the bottom up and on to the next bar, I should have seen the tic come into OnBarUpdate() that caused High[0], Bars[0] and Close[0] all be equal to the top of the bar, but this does not always happen. Often I see High[0] set to a value that I did not get a message for. What could cause this?

          If this is too confusing, I have the code and the output I can add here...

          Thanks in advance...

          -Scott

          Comment


            #6
            That is correct. We do not actually know the Close until the next bar opens.

            If the reason your next range bar is because a tick covered into that range your previous bar will only be filled in graphically. I don't believe you will get the tick for it.
            Josh P.NinjaTrader Customer Service

            Comment


              #7
              Thanks Josh.

              Knowing this helps a lot. I appriciate the quick reply!

              -Scott

              Comment

              Latest Posts

              Collapse

              Topics Statistics Last Post
              Started by Gerik, Today, 09:40 AM
              2 responses
              6 views
              0 likes
              Last Post Gerik
              by Gerik
               
              Started by RookieTrader, Today, 09:37 AM
              2 responses
              10 views
              0 likes
              Last Post RookieTrader  
              Started by alifarahani, Today, 09:40 AM
              1 response
              7 views
              0 likes
              Last Post NinjaTrader_Jesse  
              Started by KennyK, 05-29-2017, 02:02 AM
              3 responses
              1,285 views
              0 likes
              Last Post NinjaTrader_Clayton  
              Started by AttiM, 02-14-2024, 05:20 PM
              11 responses
              186 views
              0 likes
              Last Post NinjaTrader_ChelseaB  
              Working...
              X