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 Mindset, 04-21-2026, 06:46 AM
              0 responses
              101 views
              0 likes
              Last Post Mindset
              by Mindset
               
              Started by M4ndoo, 04-20-2026, 05:21 PM
              0 responses
              144 views
              0 likes
              Last Post M4ndoo
              by M4ndoo
               
              Started by M4ndoo, 04-19-2026, 05:54 PM
              0 responses
              71 views
              0 likes
              Last Post M4ndoo
              by M4ndoo
               
              Started by cmoran13, 04-16-2026, 01:02 PM
              0 responses
              125 views
              0 likes
              Last Post cmoran13  
              Started by PaulMohn, 04-10-2026, 11:11 AM
              0 responses
              79 views
              0 likes
              Last Post PaulMohn  
              Working...
              X