Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Printing Text to Output Window on the Last Bar of a Chart

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

    Printing Text to Output Window on the Last Bar of a Chart

    Hi folks,
    Wonder if anyone could help - I would like to print a single calculation result to the output window when a strategy has finished backtesting an instrument.
    In other words, is it possible to get NT to recognise the last bar of a loaded chart series so a single calculate-and-print action can then be run in a strategy?
    The idea is to be able to run a basket of instruments in a backtest, resulting in an output window with a performance calculation result for each instrument.
    Many thanks for any suggestions!
    Olly

    #2
    Olly, unfortunately there isn't a method to check if the backtest has completed.

    You can include code that writes to a file in OnBarUpdate throughout your backtest without a problem. If you know the timestamp (and date) of the last bar you're testing, you can also just try hardcoding that value into your strategy. Maybe something like in OnBarUpdate:
    Code:
    if(ToDay(Time[0]) == DayOfLastBar && ToTime(Time[0]) == TimeOfLastBar)
    {
    //insert code here that you'd like executed at the end of backtest
    }
    If you'd like to view the rest of the thread that I just picked that reply from, click here.
    AustinNinjaTrader Customer Service

    Comment


      #3
      Hi Austin - that's just the ticket and will enable me to hugely speed up my analysis!
      Thanks,
      Olly

      Comment

      Latest Posts

      Collapse

      Topics Statistics Last Post
      Started by Geovanny Suaza, 02-11-2026, 06:32 PM
      0 responses
      648 views
      0 likes
      Last Post Geovanny Suaza  
      Started by Geovanny Suaza, 02-11-2026, 05:51 PM
      0 responses
      369 views
      1 like
      Last Post Geovanny Suaza  
      Started by Mindset, 02-09-2026, 11:44 AM
      0 responses
      108 views
      0 likes
      Last Post Mindset
      by Mindset
       
      Started by Geovanny Suaza, 02-02-2026, 12:30 PM
      0 responses
      572 views
      1 like
      Last Post Geovanny Suaza  
      Started by RFrosty, 01-28-2026, 06:49 PM
      0 responses
      574 views
      1 like
      Last Post RFrosty
      by RFrosty
       
      Working...
      X