Announcement

Collapse

Looking for a User App or Add-On built by the NinjaTrader community?

Visit NinjaTrader EcoSystem and our free User App Share!

Have a question for the NinjaScript developer community? Open a new thread in our NinjaScript File Sharing Discussion Forum!
See more
See less

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
    Chris L.NinjaTrader Customer Service

    Comment


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

      Comment

      Latest Posts

      Collapse

      Topics Statistics Last Post
      Started by mkouitra, 10-23-2021, 04:40 PM
      17 responses
      1,959 views
      0 likes
      Last Post NinjaTrader_Jason  
      Started by Vietanhnguyen2hotmailcom, 05-03-2024, 10:29 AM
      4 responses
      27 views
      0 likes
      Last Post Vietanhnguyen2hotmailcom  
      Started by PhillT, 04-19-2024, 02:16 PM
      4 responses
      36 views
      0 likes
      Last Post PhillT
      by PhillT
       
      Started by ageeholdings, 05-01-2024, 05:22 AM
      5 responses
      38 views
      0 likes
      Last Post ageeholdings  
      Started by reynoldsn, Yesterday, 02:34 PM
      0 responses
      16 views
      0 likes
      Last Post reynoldsn  
      Working...
      X