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?
    BertrandNinjaTrader Customer Service

    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?
        BertrandNinjaTrader Customer Service

        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 gentlebenthebear, Today, 01:30 AM
              2 responses
              13 views
              0 likes
              Last Post gentlebenthebear  
              Started by Kaledus, Today, 01:29 PM
              2 responses
              7 views
              0 likes
              Last Post Kaledus
              by Kaledus
               
              Started by frankthearm, Yesterday, 09:08 AM
              13 responses
              45 views
              0 likes
              Last Post frankthearm  
              Started by PaulMohn, Today, 12:36 PM
              2 responses
              16 views
              0 likes
              Last Post PaulMohn  
              Started by Conceptzx, 10-11-2022, 06:38 AM
              2 responses
              56 views
              0 likes
              Last Post PhillT
              by PhillT
               
              Working...
              X