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 bortz, 11-06-2023, 08:04 AM
      47 responses
      1,610 views
      0 likes
      Last Post aligator  
      Started by jaybedreamin, Today, 05:56 PM
      0 responses
      9 views
      0 likes
      Last Post jaybedreamin  
      Started by DJ888, 04-16-2024, 06:09 PM
      6 responses
      19 views
      0 likes
      Last Post DJ888
      by DJ888
       
      Started by Jon17, Today, 04:33 PM
      0 responses
      6 views
      0 likes
      Last Post Jon17
      by Jon17
       
      Started by Javierw.ok, Today, 04:12 PM
      0 responses
      16 views
      0 likes
      Last Post Javierw.ok  
      Working...
      X