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 mangel2000, Today, 01:30 AM
                0 responses
                3 views
                0 likes
                Last Post mangel2000  
                Started by Doxxxx, Today, 01:24 AM
                0 responses
                3 views
                0 likes
                Last Post Doxxxx
                by Doxxxx
                 
                Started by ezekilany, Today, 01:10 AM
                0 responses
                4 views
                0 likes
                Last Post ezekilany  
                Started by usjavaburn, Today, 12:59 AM
                0 responses
                3 views
                0 likes
                Last Post usjavaburn  
                Started by heatherjmarshalls, Today, 12:56 AM
                0 responses
                2 views
                0 likes
                Last Post heatherjmarshalls  
                Working...
                X