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.
    BertrandNinjaTrader Customer Service

    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.
        BertrandNinjaTrader Customer Service

        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 mattbsea, Today, 05:44 PM
                0 responses
                5 views
                0 likes
                Last Post mattbsea  
                Started by RideMe, 04-07-2024, 04:54 PM
                6 responses
                31 views
                0 likes
                Last Post RideMe
                by RideMe
                 
                Started by tkaboris, Today, 05:13 PM
                0 responses
                2 views
                0 likes
                Last Post tkaboris  
                Started by GussJ, 03-04-2020, 03:11 PM
                16 responses
                3,282 views
                0 likes
                Last Post Leafcutter  
                Started by WHICKED, Today, 12:45 PM
                2 responses
                20 views
                0 likes
                Last Post WHICKED
                by WHICKED
                 
                Working...
                X