Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

All stratagies initialized when open BackTester window?

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

    All stratagies initialized when open BackTester window?

    I've noticed that if strategies have Print statements in the Initialize() procedure that when I open the Backtest window to setup a Strategy for backtesting, the Output window will display the output from the Print statements of every strategy. This leads me to a question:

    Are all my strategies being Initialized when I open the BackTester window?

    If so, this would have a big impact on my revision control scheme. Right now if I want a version snapshot of a strategy, I'll save it to a new file name. Thus, I have dozens of work-in-process strategies in my strategy directory and Ninja would be un-necessarily initializing those WIP strategies which I'm sure consumes system resources and possibly could cause other problems.

    #2
    That is correct. The Initialize() method is called for all your scripts. You should not put any logic in Initialize(). All logic and calculations should be done in OnBarUpdate(). If you want it to run only once you should do it in the context of if (CurrentBar == 0).
    Josh P.NinjaTrader Customer Service

    Comment


      #3
      Ok, thanks Josh. What concerns me is the Add() statements which I use to display indicators on the Strategy Analyzer chart and the new DataSeries statements I use for initializing internal variables. I must have hundreds of Add() and new DataSeries statements across all my strategy Initialize() procedures. That has got to eat up un-necessary Windows system resources.

      Regards,

      David
      dbw451

      Comment


        #4
        No worries. The actual memory consuming series are filled in by NT not as you call Add ... in Initialize() but only as the indicator/strategy would go live right before calling OnBarUpdate().

        Comment


          #5
          That's good news. Thanks Dierk.

          Regards,

          David
          dbw451

          Comment

          Latest Posts

          Collapse

          Topics Statistics Last Post
          Started by funk10101, Today, 12:02 AM
          1 response
          11 views
          0 likes
          Last Post NinjaTrader_LuisH  
          Started by GLFX005, Today, 03:23 AM
          1 response
          6 views
          0 likes
          Last Post NinjaTrader_Erick  
          Started by nandhumca, Yesterday, 03:41 PM
          1 response
          13 views
          0 likes
          Last Post NinjaTrader_Gaby  
          Started by The_Sec, Yesterday, 03:37 PM
          1 response
          11 views
          0 likes
          Last Post NinjaTrader_Gaby  
          Started by vecnopus, Today, 06:15 AM
          0 responses
          1 view
          0 likes
          Last Post vecnopus  
          Working...
          X