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 Geovanny Suaza, 02-11-2026, 06:32 PM
      0 responses
      633 views
      0 likes
      Last Post Geovanny Suaza  
      Started by Geovanny Suaza, 02-11-2026, 05:51 PM
      0 responses
      364 views
      1 like
      Last Post Geovanny Suaza  
      Started by Mindset, 02-09-2026, 11:44 AM
      0 responses
      105 views
      0 likes
      Last Post Mindset
      by Mindset
       
      Started by Geovanny Suaza, 02-02-2026, 12:30 PM
      0 responses
      567 views
      1 like
      Last Post Geovanny Suaza  
      Started by RFrosty, 01-28-2026, 06:49 PM
      0 responses
      568 views
      1 like
      Last Post RFrosty
      by RFrosty
       
      Working...
      X