Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Is there a a method or state for when backtest finishes completely?

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

    Is there a a method or state for when backtest finishes completely?

    I would like to save down a custom set of data for analysis after a backtest finishes. In other platforms there used to be a method OnExit() I could use, but I cannot find anything like that in NT8.

    It would be ideal if i can interject when the last closing order (the one that NT places automatically when there is an open position) has been processed. I could monitor the OnExecutionUpdate but that would not help if there was no open position.

    Alternatively, is there a way of knowing the currentbar is the very last bar?

    Thanks for your help


    #2
    Hi crystalet , thanks for posting.

    You can identify the end of the backtest with the BarsArray count:
    if(CurrentBar == BarsArray[0].Count-2)

    State.Terminated is also hit several times at the end of the backtest.

    Kind regards,
    -ChrisL

    Comment


      #3
      ok i will see if i can use this - thanks

      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
      51 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