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 CarlTrading, 03-31-2026, 09:41 PM
              1 response
              32 views
              0 likes
              Last Post NinjaTrader_ChelseaB  
              Started by CarlTrading, Yesterday, 02:41 AM
              0 responses
              14 views
              0 likes
              Last Post CarlTrading  
              Started by CaptainJack, 03-31-2026, 11:44 PM
              0 responses
              23 views
              1 like
              Last Post CaptainJack  
              Started by CarlTrading, 03-30-2026, 11:51 AM
              0 responses
              40 views
              0 likes
              Last Post CarlTrading  
              Started by CarlTrading, 03-30-2026, 11:48 AM
              0 responses
              34 views
              0 likes
              Last Post CarlTrading  
              Working...
              X