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

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 Austiner87, Today, 03:42 PM
      1 response
      14 views
      0 likes
      Last Post NinjaTrader_Manfred  
      Started by cshox, Today, 11:11 AM
      2 responses
      14 views
      0 likes
      Last Post cshox
      by cshox
       
      Started by algospoke, Today, 06:53 PM
      0 responses
      5 views
      0 likes
      Last Post algospoke  
      Started by mlprice12, 12-21-2021, 04:55 PM
      3 responses
      293 views
      0 likes
      Last Post paypachaysa  
      Started by lorem, 04-25-2024, 09:18 AM
      20 responses
      85 views
      0 likes
      Last Post lorem
      by lorem
       
      Working...
      X