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

Does using Print() slow down the strategy analyzer?

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

    Does using Print() slow down the strategy analyzer?

    I added a bunch of Prints to my strategy to try and debug it and I'm curious if that will slow down the Strategy Analyzer, and if so, is there a way to speed it up?

    In java we do a:

    if(log.isDebugEnabled) {
    log.debug("blah blah blah");
    }

    so that it only logs if we have the log activated.

    I was thinking of doing something like:

    if(Historical) {
    Print("blah");
    }

    but the only catch is that when I run the strategy live and it catches up it wouldn't print out the debugging info which is really useful to know what the strategy is doing.

    Any other ideas?

    If I had:

    if(OptimizerInProgress) {
    Print("...");
    }

    that would be ideal, as I want the logs all the time EXCEPT when optimizing. Is there a way to detect if the optimizer is running?

    #2
    It definitely would slow down the SA. You could add a strategy parameter. If 1 -> Print, if 0 -> don't Print.

    Comment


      #3
      Originally posted by NinjaTrader_Dierk View Post
      It definitely would slow down the SA. You could add a strategy parameter. If 1 -> Print, if 0 -> don't Print.
      I ended up just defining a variable

      bool log = false;

      then I use

      if(log) {
      Print("...");
      }

      when I run it live I guess I'll just change the code. I agree about making a parameter but I already have so many I hate to add more.

      I ran my strategy before this modification and it said 6 minutes remaining. I stopped it and added the if(log) and then reran and it started at 3 minutes. So it looks like it's running twice as fast. That's a big improvement.

      Thanks

      Comment

      Latest Posts

      Collapse

      Topics Statistics Last Post
      Started by Barry Milan, Yesterday, 10:35 PM
      5 responses
      18 views
      0 likes
      Last Post NinjaTrader_Manfred  
      Started by DanielSanMartin, Yesterday, 02:37 PM
      2 responses
      13 views
      0 likes
      Last Post DanielSanMartin  
      Started by DJ888, 04-16-2024, 06:09 PM
      4 responses
      13 views
      0 likes
      Last Post DJ888
      by DJ888
       
      Started by terofs, Today, 04:18 PM
      0 responses
      12 views
      0 likes
      Last Post terofs
      by terofs
       
      Started by nandhumca, Today, 03:41 PM
      0 responses
      8 views
      0 likes
      Last Post nandhumca  
      Working...
      X