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

current bar previous bar

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

    current bar previous bar

    hi,

    i have a strategy that will calculate on bar close only.

    i want to compare the close from the closed bar with the bollinger values of that closed bar. is this then bollinger[1] < close[1] or is it bollinger[1] < close[0] because the current bar does not have a close ? i suppose that if my strategy starts calculating the new bar is alreadu created with an open etc and i need to do everything on the [1] bar or is [0] the bar that is closed ?
    little confused !

    #2
    Hello,

    Thank you for your post.

    If you are referencing the value of the Close and the Bollinger on the same bar you want to use the same index.

    An index of [0] will return the most recent price in any case. Since you have CalculateOnBarClose set to true, an index of [0] will return the most recent price of the last closed bar.

    From your description, it sound like you want to use bollinger[0] < close[0].
    DenNinjaTrader Customer Service

    Comment


      #3
      thanks Ben

      so the bollinger [0] are the bollinger values of the closed bar and not the current bar that is plotted will my calculation runs because it is on bar update = true ? so an open [0] is not the current price but the open of the closed bar

      Comment


        #4
        Hello,

        It sounds like you are on the right track.

        Think of it this way. When CalculateOnBarClose is set to true, the building bar does not exist and the "most recent price" is now on the closed bar.
        DenNinjaTrader Customer Service

        Comment


          #5
          thanks i got it !

          Comment

          Latest Posts

          Collapse

          Topics Statistics Last Post
          Started by pechtri, 06-22-2023, 02:31 AM
          9 responses
          122 views
          0 likes
          Last Post NinjaTrader_ChelseaB  
          Started by frankthearm, 04-18-2024, 09:08 AM
          16 responses
          66 views
          0 likes
          Last Post NinjaTrader_Clayton  
          Started by habeebft, Today, 01:18 PM
          1 response
          5 views
          0 likes
          Last Post NinjaTrader_ChelseaB  
          Started by benmarkal, Today, 12:52 PM
          2 responses
          13 views
          0 likes
          Last Post benmarkal  
          Started by f.saeidi, Today, 01:38 PM
          1 response
          7 views
          0 likes
          Last Post NinjaTrader_BrandonH  
          Working...
          X