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 bmartz, 03-12-2024, 06:12 AM
      5 responses
      33 views
      0 likes
      Last Post NinjaTrader_Zachary  
      Started by Aviram Y, Today, 05:29 AM
      4 responses
      13 views
      0 likes
      Last Post Aviram Y  
      Started by algospoke, 04-17-2024, 06:40 PM
      3 responses
      28 views
      0 likes
      Last Post NinjaTrader_Jesse  
      Started by gentlebenthebear, Today, 01:30 AM
      1 response
      8 views
      0 likes
      Last Post NinjaTrader_Jesse  
      Started by cls71, Today, 04:45 AM
      1 response
      8 views
      0 likes
      Last Post NinjaTrader_ChelseaB  
      Working...
      X