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 geddyisodin, Today, 05:20 AM
          1 response
          11 views
          0 likes
          Last Post NinjaTrader_Gaby  
          Started by Max238, Today, 01:28 AM
          3 responses
          32 views
          0 likes
          Last Post Max238
          by Max238
           
          Started by timko, Today, 06:45 AM
          2 responses
          13 views
          0 likes
          Last Post NinjaTrader_ChristopherJ  
          Started by habeebft, Today, 07:27 AM
          0 responses
          5 views
          0 likes
          Last Post habeebft  
          Started by Tim-c, Today, 03:54 AM
          1 response
          8 views
          0 likes
          Last Post NinjaTrader_BrandonH  
          Working...
          X