Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

needless instantiation of all strategies, StrategyAnalyzer NT8 B12

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

    needless instantiation of all strategies, StrategyAnalyzer NT8 B12

    By adding some Print statements in a couple of strategies I have found that all strategies get instantiated (OnStateChange called with State.SetDefaults then State.Terminated in the following cases:
    A) Twice when StrategyAnalyzer is started. I can understand why this might be needed once, but why twice?
    B) When changing the selected strategy.
    C) When Backtest type combo is changed.
    D) Every time a strategy is run (Backtest type = Standard).
    E) When backtest type is changed.
    F) If instrument is changed.
    G) If Data Series Type is changed.
    H) If Order Fill Resolution is changed.
    I) If Set Order Quantity combo is changed.

    At the moment I dont have many strategies in NT8 or much code in SetDefaults, but unnecessary instantiation of things I dont need right now seems to be asking for problems.
    Lets say I wanted to connect to another slow-to-respond application in a strategy. If I did this in State.SetDefaults then that would slow down testing of all other strategies. I suppose that sort of thing needs to go into State.Configure instead?

    #2
    This raises an interesting question. Would we get better overall performance if we deleted all unused indicators and strategies from their respective directories? NT can be a pig on memory all by itself. Would doing this help?
    Thanks ... Ed

    Comment


      #3
      Hi Ed,
      Currently Strategy Analyzer "only" keeps instantiating all Strategies (not Indicators).
      I think a similar thing occurred in NT7 where I had to keep moving unused strategies out of the folders NT7 looked at, otherwise Strategy Analyzer became unusable.

      Comment


        #4
        Very interesting. I have a pile of unused strats. I'll remove them and see if my performance improves. Optimizing is agonizingly slow as it is! Don't need to make it worse.
        THanks ... Ed

        Comment


          #5
          In Charts. Every time the Indicators dialog is opened (eg Ctrl I), NT currently instantiates all Indicators (OnStateChange called with State.SetDefaults then State.Terminated).
          This seems necessary in the current design because for example the name displayed in the "Available" list comes from the Name property set in State.SetDefaults

          But if someone has added loads of custom indicators and is finding the Indicators dialog slow to display, they may want to move unused indicators somewhere else.

          Comment


            #6
            Hello,

            Thank you for the post.

            It would be expected to see the SetDefaults and Terminated called multiple times depending on the actions being completed in the platform.

            This instantiation is to get the Defaults of the NinjaScript item for populating menus and other areas where the item is seen. This does not fully instantiate the script to where it is running but only the SetDefaults to get its defaults and then is terminated. This is the same concept as it had already existed in NT7, only it was the Initialize being called in NT7.

            It is certainly possible that a developer that is un aware of this concept could create items that make the menus load slowly, for example if you put some type of logic that requires time to complete in SetDefaults. In general the default items, or items that do not execute logic in this portion of the script specifically should not slow the platform down.

            I would suspect having thousands of items installed could take longer to load as the amount of items to display has increased. As DaveE said, if you are experiencing items causing slowness it may be wise to remove unused items to see if one of these is creating this type of situation.

            You can find more information about this on the States page here: http://ninjatrader.com/support/helpG...ghtsub=onstate


            Please let me know if I may be of additional assistance.
            JesseNinjaTrader Customer Service

            Comment

            Latest Posts

            Collapse

            Topics Statistics Last Post
            Started by algospoke, Yesterday, 06:40 PM
            2 responses
            22 views
            0 likes
            Last Post algospoke  
            Started by ghoul, Today, 06:02 PM
            3 responses
            14 views
            0 likes
            Last Post NinjaTrader_Manfred  
            Started by jeronymite, 04-12-2024, 04:26 PM
            3 responses
            45 views
            0 likes
            Last Post jeronymite  
            Started by Barry Milan, Yesterday, 10:35 PM
            7 responses
            21 views
            0 likes
            Last Post NinjaTrader_Manfred  
            Started by AttiM, 02-14-2024, 05:20 PM
            10 responses
            181 views
            0 likes
            Last Post jeronymite  
            Working...
            X