Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

How to detect last bar of Strategy analyzer run so I can dump info

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

    How to detect last bar of Strategy analyzer run so I can dump info

    Hi,
    I want to dump some data at the end of a strategy run.
    Currently I am triggering on bar number, or using Bars.GetBar(***)

    Problem is when I change the shape of the bar, I have to fish around to get the last bar number or bar date.

    Is there an easier way to do this?

    #2
    Hello, thanks for your post.

    We have the IsLastBarOfSession property for this:
    https://ninjatrader.com/support/help...rofsession.htm

    If your strategy runs OnPriceChange or OnEachTick, you will need to use the SessionIterator instead:
    https://ninjatrader.com/support/help...oniterator.htm

    Unfortunately, there is nothing pre-made that will tell you when the backtest completes specificaly, your code would need to check for the proper date to gather the information.

    Please let me know if I can assist any further.

    Comment


      #3
      Why not just do that data dumping from State.Terminated?

      Comment

      Latest Posts

      Collapse

      Topics Statistics Last Post
      Started by CarlTrading, 03-31-2026, 09:41 PM
      1 response
      47 views
      0 likes
      Last Post NinjaTrader_ChelseaB  
      Started by CarlTrading, 04-01-2026, 02:41 AM
      0 responses
      23 views
      0 likes
      Last Post CarlTrading  
      Started by CaptainJack, 03-31-2026, 11:44 PM
      0 responses
      33 views
      1 like
      Last Post CaptainJack  
      Started by CarlTrading, 03-30-2026, 11:51 AM
      0 responses
      50 views
      0 likes
      Last Post CarlTrading  
      Started by CarlTrading, 03-30-2026, 11:48 AM
      0 responses
      42 views
      0 likes
      Last Post CarlTrading  
      Working...
      X