Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Back test vs historical chart loading

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

    Back test vs historical chart loading

    I have an indicator that prints lots of labels on a chart. This drastically slows down the back testing engine when testing large amounts of time because of the chart it builds at the end. I would like for the indicator to not print the labels during back testing, but be able to print them on the historic data when I manually open a chart. Is there a way to do this? Are there any States unique to back testing or a chart loading outside of the strategy analyzer that I can check for?

    If not I guess I could check the timestamp of the bar and compare it to the current date and only print labels for the last x days...? Any other ideas?

    Thanks,
    Nick

    #2
    Hello NickyD,

    Thank you for the question.

    The option with the most flexibility would be to add a bool input to the script. You could set it to default as True so you don't need to mess with it outside of the backtest, in a backtest, you could set it to false to disable drawing. This would also allow you to disable the drawings in the chart to increase performance when they are not needed.

    Alternatively there is a property for backtesting:

    Code:
    Print(IsInStrategyAnalyzer);
    You would need to use this bool from your strategy, and then change the properties of the indicator based on its value. The above statement about adding a bool input would still apply to the indicator while using IsInStrategyAnalyzer, the input would be used to control the indicator.


    I look forward to being of further assistance.
    Last edited by NinjaTrader_Jesse; 10-04-2018, 10:30 AM.

    Comment


      #3
      A good solution. Thanks!

      Comment

      Latest Posts

      Collapse

      Topics Statistics Last Post
      Started by CaptainJack, 05-29-2026, 05:09 AM
      0 responses
      227 views
      0 likes
      Last Post CaptainJack  
      Started by CaptainJack, 05-29-2026, 12:02 AM
      0 responses
      145 views
      0 likes
      Last Post CaptainJack  
      Started by charlesugo_1, 05-26-2026, 05:03 PM
      0 responses
      159 views
      1 like
      Last Post charlesugo_1  
      Started by DannyP96, 05-18-2026, 02:38 PM
      1 response
      237 views
      0 likes
      Last Post NinjaTrader_ChelseaB  
      Started by CarlTrading, 05-11-2026, 05:56 AM
      0 responses
      197 views
      0 likes
      Last Post CarlTrading  
      Working...
      X