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 argusthome, 03-08-2026, 10:06 AM
                0 responses
                110 views
                0 likes
                Last Post argusthome  
                Started by NabilKhattabi, 03-06-2026, 11:18 AM
                0 responses
                59 views
                0 likes
                Last Post NabilKhattabi  
                Started by Deep42, 03-06-2026, 12:28 AM
                0 responses
                37 views
                0 likes
                Last Post Deep42
                by Deep42
                 
                Started by TheRealMorford, 03-05-2026, 06:15 PM
                0 responses
                41 views
                0 likes
                Last Post TheRealMorford  
                Started by Mindset, 02-28-2026, 06:16 AM
                0 responses
                78 views
                0 likes
                Last Post Mindset
                by Mindset
                 
                Working...
                X