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 alifarahani, Today, 09:40 AM
      2 responses
      12 views
      0 likes
      Last Post alifarahani  
      Started by junkone, Today, 11:37 AM
      3 responses
      15 views
      0 likes
      Last Post NinjaTrader_ChelseaB  
      Started by pickmyonlineclass, Today, 12:23 PM
      0 responses
      1 view
      0 likes
      Last Post pickmyonlineclass  
      Started by frankthearm, Yesterday, 09:08 AM
      12 responses
      44 views
      0 likes
      Last Post NinjaTrader_Clayton  
      Started by quantismo, 04-17-2024, 05:13 PM
      5 responses
      35 views
      0 likes
      Last Post NinjaTrader_Gaby  
      Working...
      X