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 rdtdale, Yesterday, 01:02 PM
      2 responses
      16 views
      0 likes
      Last Post rdtdale
      by rdtdale
       
      Started by TradeSaber, Today, 07:18 AM
      0 responses
      7 views
      0 likes
      Last Post TradeSaber  
      Started by PaulMohn, Today, 05:00 AM
      0 responses
      10 views
      0 likes
      Last Post PaulMohn  
      Started by ZenCortexAuCost, Today, 04:24 AM
      0 responses
      6 views
      0 likes
      Last Post ZenCortexAuCost  
      Started by ZenCortexAuCost, Today, 04:22 AM
      0 responses
      3 views
      0 likes
      Last Post ZenCortexAuCost  
      Working...
      X