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

suggest new onBarClose() method

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

    suggest new onBarClose() method

    It would be logical to have an OnBarClose() method that always executes at the bar close, regardless of the "CalculateOnBarClose" property setting.

    It would allow code to be more efficient and improve performance.
    Those tasks which don't need intraday bar updates can be in the second method and those tasks which do require intraday bar updates can be in the onBarUpdate() method with "CalculateOnBarClose" set to false.

    #2
    You can do what you want now.

    Please check out the FirstTickOfBar property. Your OnBarUpdate() method could check for this and when the property value is true, you can execute your OnBarClose() code. Just keep in mind that you will need to reference values from 1 bar ago for the bar close values.
    RayNinjaTrader Customer Service

    Comment


      #3
      I have been investigating this. It is not as clean which is why I made the suggestion. (I like clean code)

      For example, when coding with the Plots container, current bar values are set via Values[2].Set(Volume[0]);


      However, to change the previous bar plot, this does not seem to work:
      Values[2][1].Set(Volume[1]);

      I am still trying to figure out how to alter the prior bar's plot value.

      Comment


        #4
        Try,

        Values[2].Set(1, Volume[1]);
        RayNinjaTrader Customer Service

        Comment


          #5
          Originally posted by NinjaTrader_Ray View Post
          Try,

          Values[2].Set(1, Volume[1]);

          Sometimes I am an idiot. Thank you!

          Comment

          Latest Posts

          Collapse

          Topics Statistics Last Post
          Started by gemify, 11-11-2022, 11:52 AM
          6 responses
          803 views
          2 likes
          Last Post ultls
          by ultls
           
          Started by ScottWalsh, Today, 04:52 PM
          0 responses
          3 views
          0 likes
          Last Post ScottWalsh  
          Started by ScottWalsh, Today, 04:29 PM
          0 responses
          7 views
          0 likes
          Last Post ScottWalsh  
          Started by rtwave, 04-12-2024, 09:30 AM
          2 responses
          22 views
          0 likes
          Last Post rtwave
          by rtwave
           
          Started by tsantospinto, 04-12-2024, 07:04 PM
          5 responses
          70 views
          0 likes
          Last Post tsantospinto  
          Working...
          X