Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Write my Backtest Result on the Output window

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

    Write my Backtest Result on the Output window

    Hi, I would like to know how I could write the piece of the code where I could write afew things on the output window once my Backtest has finalized.

    This is so that when I run an optimization with a few hundred thousand simulations I wanna see all parameters from all simulations and its results so I can export it and anylize them on Matlab. The problem with NinjaTrader is that it can only store up to the best 400 data points from my optimization and I need them all actually.

    Is there some sort of function OnBackTestFinalizationWrite( ), this would work awsome

    Thanks for your help.

    #2
    adelvalle,

    You can figure out the last bar that will be in your backtest time frame and then do a Print() from there.

    Code:
    if (ToDay(Time[0]) == 20080910 && ToTime(Time[0]) == 160000)
         Print("some message");
    Josh P.NinjaTrader Customer Service

    Comment


      #3
      If you want to print the stats at the last bar you can do something like

      Code:
      [FONT=Courier New][SIZE=2][FONT=Courier New][SIZE=2]if(CurrentBar == Bars.Count)[/SIZE][/FONT]
      [SIZE=2][FONT=Courier New]{[/FONT][/SIZE]
      [SIZE=2][FONT=Courier New]PrintStats();[/FONT][/SIZE]
      [SIZE=2][FONT=Courier New]}[/FONT][/SIZE]
      [/SIZE][/FONT]
      or

      Code:
      if(CurrentBar == Bars.Count-1)
      {
       PrintStats();
      }
      depending on if CalculateOnBarClose is true or false.

      Comment

      Latest Posts

      Collapse

      Topics Statistics Last Post
      Started by CarlTrading, 03-31-2026, 09:41 PM
      1 response
      152 views
      1 like
      Last Post NinjaTrader_ChelseaB  
      Started by CarlTrading, 04-01-2026, 02:41 AM
      0 responses
      89 views
      1 like
      Last Post CarlTrading  
      Started by CaptainJack, 03-31-2026, 11:44 PM
      0 responses
      133 views
      2 likes
      Last Post CaptainJack  
      Started by CarlTrading, 03-30-2026, 11:51 AM
      0 responses
      127 views
      1 like
      Last Post CarlTrading  
      Started by CarlTrading, 03-30-2026, 11:48 AM
      0 responses
      107 views
      0 likes
      Last Post CarlTrading  
      Working...
      X