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 Segwin, 05-07-2018, 02:15 PM
          10 responses
          1,769 views
          0 likes
          Last Post Leafcutter  
          Started by Rapine Heihei, 04-23-2024, 07:51 PM
          2 responses
          30 views
          0 likes
          Last Post Max238
          by Max238
           
          Started by Shansen, 08-30-2019, 10:18 PM
          24 responses
          943 views
          0 likes
          Last Post spwizard  
          Started by Max238, Today, 01:28 AM
          0 responses
          10 views
          0 likes
          Last Post Max238
          by Max238
           
          Started by rocketman7, Today, 01:00 AM
          0 responses
          7 views
          0 likes
          Last Post rocketman7  
          Working...
          X