Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Run code at END of OnBarUpdate()

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

    Run code at END of OnBarUpdate()

    Is there a way I can hook in code to run automatically after all the OnBarUpdates are finished when running a strategy through the strategy analyzer?

    I am exporting price data for multiple stocks, and I want to run some C# when it has finished its export over a specified time range. Where/how do I run code after it has finished all the OnBarUpdates()?

    #2
    theGreek, you mean to determine programmatically when the backtest is finished? Unfortunately this is not supported.

    Comment


      #3
      Bertrand,
      It is supported!!

      Baruch

      Comment


        #4
        Not sure I follow Baruch, there's no property / method telling you when the backtest is done...so I'm not quite sure what you refer to.

        Comment


          #5
          Yes Bertrand, that is what I need to accomplish.

          Baruch, if this is possible, how do you accomplish this?

          Comment


            #6
            if (Bars.CurrentBar == Bars.Count - 2) // you are on the last bar of the back test. What here is exactly undocumented? Maybe "-2"?

            Baruch

            Comment


              #7
              That was exactly it Baruch. Thank you! Did not know about the existence of Bars.Count. Great!

              Comment


                #8
                Originally posted by Baruch View Post
                if (Bars.CurrentBar == Bars.Count - 2) // you are on the last bar of the back test. What here is exactly undocumented? Maybe "-2"?

                Baruch
                Only CurrentBar is documented.

                Comment

                Latest Posts

                Collapse

                Topics Statistics Last Post
                Started by CaptainJack, 05-29-2026, 05:09 AM
                0 responses
                336 views
                0 likes
                Last Post CaptainJack  
                Started by CaptainJack, 05-29-2026, 12:02 AM
                0 responses
                211 views
                0 likes
                Last Post CaptainJack  
                Started by charlesugo_1, 05-26-2026, 05:03 PM
                0 responses
                196 views
                1 like
                Last Post charlesugo_1  
                Started by DannyP96, 05-18-2026, 02:38 PM
                1 response
                288 views
                0 likes
                Last Post NinjaTrader_ChelseaB  
                Started by CarlTrading, 05-11-2026, 05:56 AM
                0 responses
                245 views
                0 likes
                Last Post CarlTrading  
                Working...
                X