Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Quick Check on CurrentBar

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

    Quick Check on CurrentBar

    Hello,

    The NT documentation states that CurrentBar starts at index value zero. On running my strategy through the VS debugger however, I get the value to be 1. (I am running OnBarUpdate on each tick.) Any explanations?

    thanks

    #2
    Hi trader_rick, checked mine briefly and get the correct value 0 for the very first bar on the chart - are you sure you checked the correct bar in your debugger?

    Comment


      #3
      Hi Bertrand,

      Well, it's the first line of code in OnBarUpdate. To double check, I added

      Print( CurrentBar.ToString( ) )

      within OnBarUpdate and in the output window counting starts at 1. I'm using NT 6.5.1000.8 and I'm sending tick data through the .NET ATI using a tick server that I built.

      By the way, wow! Quick response. Very impressive.

      thanks

      Comment


        #4
        Thanks - what's your min bars required setting when starting the strategy? Is this also set to 0?

        Comment


          #5
          I have

          BarsRequired = 1;

          Comment


            #6
            trader_rick,

            That is why you start out at 1. For a strategy, it does not process any OnBarUpdate() events until the minimum bars required parameter is met. This means 1 in your case. The first OnBarUpdate() event will be on bar 1.
            Josh P.NinjaTrader Customer Service

            Comment


              #7
              Doh!

              Thanks josh. That makes sense.

              (I didn't get much sleep last night - anyway, that's my story and I'm sticking to it.)

              Comment

              Latest Posts

              Collapse

              Topics Statistics Last Post
              Started by argusthome, 03-08-2026, 10:06 AM
              0 responses
              108 views
              0 likes
              Last Post argusthome  
              Started by NabilKhattabi, 03-06-2026, 11:18 AM
              0 responses
              55 views
              0 likes
              Last Post NabilKhattabi  
              Started by Deep42, 03-06-2026, 12:28 AM
              0 responses
              37 views
              0 likes
              Last Post Deep42
              by Deep42
               
              Started by TheRealMorford, 03-05-2026, 06:15 PM
              0 responses
              39 views
              0 likes
              Last Post TheRealMorford  
              Started by Mindset, 02-28-2026, 06:16 AM
              0 responses
              75 views
              0 likes
              Last Post Mindset
              by Mindset
               
              Working...
              X