• If this is your first visit, you will have to register before you can post. To view messages, please scroll below and select the forum that you would like to visits. Questions? Be sure to check out the Forum FAQ.

Announcement

Collapse
No announcement yet.

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 johnnybegoode, Today, 11:35 AM
          1 response
          9 views
          0 likes
          Last Post NinjaTrader_ChrisL  
          Started by NickyD, Today, 09:07 AM
          3 responses
          14 views
          0 likes
          Last Post NickyD
          by NickyD
           
          Started by 7robert, Today, 06:46 AM
          3 responses
          62 views
          0 likes
          Last Post NinjaTrader_ChrisL  
          Started by ElMagoR, Today, 07:49 AM
          4 responses
          31 views
          0 likes
          Last Post NinjaTrader_ChrisL  
          Started by Nabil, 09-13-2019, 11:44 AM
          5 responses
          35 views
          0 likes
          Last Post Nabil
          by Nabil
           
          Working...
          X