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 Board game geek, Today, 01:34 AM
      0 responses
      4 views
      0 likes
      Last Post Board game geek  
      Started by morrnel, 05-12-2024, 06:07 PM
      3 responses
      38 views
      0 likes
      Last Post wzgy0920  
      Started by FishTrade, Yesterday, 11:11 PM
      0 responses
      7 views
      0 likes
      Last Post FishTrade  
      Started by Austiner87, Yesterday, 03:42 PM
      1 response
      21 views
      0 likes
      Last Post NinjaTrader_Manfred  
      Started by cshox, Yesterday, 11:11 AM
      2 responses
      16 views
      0 likes
      Last Post cshox
      by cshox
       
      Working...
      X