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

Bars.Period.Value

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

    Bars.Period.Value

    If I add the following code to the initialize method it blows up my code

    tCI= Bars.Period.Value;

    where tCI is defined as a private int , it compiles but my code blows out. The log says that bars in Progress cannot be accessed from within initialize. Is there some reason Bars.Period.Value cannot be accessed in the Initialize method. Ultimately I am trying to select the file name of the wave file that be used for certain alerts based on the chart compression. It seems logical to do that in initialize. Where am I going wrong?

    thanks
    Jerry

    #2
    Originally posted by JerryWar View Post
    ... Is there some reason Bars.Period.Value cannot be accessed in the Initialize method.... It seems logical to do that in initialize. Where am I going wrong?

    thanks
    Jerry
    The only reason why is because those who designed the NT framework decided as part of their design that Bars should not be accessible from that method. You need to work within the documented constraints of the framework. (Just for the record, I too hate that I cannot access those properties from the Initialize() method).

    Comment


      #3
      Koganam, - I needed confirmation that the message was in fact the real issue. I had already
      wrote some code that got around it by creating a dorky flag to only process the code once.I just hate having to write code like that.

      Thanks
      Jerry

      Comment


        #4
        Jerry, sorry for our late reply - koganam is correct, unfortunately we could not support dynamic adding / access of the bars object in the Initialize() method. That feedback is on our internal product enhancement list to consider as we're working on our next major platform update and refinements for the framework offered, I could not offer a commitment or ETA unfortunately at this point in time.
        BertrandNinjaTrader Customer Service

        Comment


          #5
          Bertrand - The chart compression by any reasonable definition in relation to the indicator code is Static. If you change the chart compression i would like to think you totally rerun the indicator from scratch, initialization and all. Dynamic adding would be a more complicated case.
          Regardless, I have it working, I don't understand the logic or details of your framework that well which is why it gets me in trouble now and again.

          Thanks
          Jerry

          Comment

          Latest Posts

          Collapse

          Topics Statistics Last Post
          Started by Jon17, Today, 04:33 PM
          0 responses
          1 view
          0 likes
          Last Post Jon17
          by Jon17
           
          Started by Javierw.ok, Today, 04:12 PM
          0 responses
          6 views
          0 likes
          Last Post Javierw.ok  
          Started by timmbbo, Today, 08:59 AM
          2 responses
          10 views
          0 likes
          Last Post bltdavid  
          Started by alifarahani, Today, 09:40 AM
          6 responses
          41 views
          0 likes
          Last Post alifarahani  
          Started by Waxavi, Today, 02:10 AM
          1 response
          21 views
          0 likes
          Last Post NinjaTrader_LuisH  
          Working...
          X