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

Which ones are disposable elements? (what needs to use dispose() )?

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

    Which ones are disposable elements? (what needs to use dispose() )?

    In indicators, what type of elements needs to be disposed?

    i.e. fonts? Plot Colors? where is written full list and good example for NT7 (in addition, NT8 is welcomed too).

    so, indicators wont leave memory used in buffer and released everything correctly.

    I need all list and complete code by which i can instruct for my every indicator.

    #2
    Hello,

    Thank you for the post.

    NinajTrader will generally clean up resources for objects it creates so you do not need to. The disposal of resources we describe briefly in the help guide really only relates to custom objects you create that may require cleanup. One example would be a class you created that has Dispose implemented. Another example would be a custom event handler subscription and unsubscribe from that. Outside of custom objects that you may create that may require disposing of, you really wouldn't need to worry about doing this.

    This is also not something I could provide a complete list of as there is not a complete list of these items. Generally, if you are using some syntax that requires a Dispose, it would be listed where you found that syntax. Any NinjaTrader specific syntax that needs disposing of would be listed in the sample/indicator/type where it was used. A good example of this is found in NT8, the sharpdx resources that do need to be disposed of are disposed of and this is shown in their syntax.

    There are not any specific resources for NT7 that I could recommend calling dispose for. A better question may be, are you seeing a specific indicator have its memory rise uncontrollably or in an unreasonable way? If so, we could further explore that indicator to see what objects were used and what may be causing the problem.





    I look forward to being of further assistance.
    JesseNinjaTrader Customer Service

    Comment


      #3
      Thank you NT SUPPORT! you are excellent.

      Yes, i have specific problem with this indicator:

      Comment


        #4
        Hello,

        Thank you for the reply.

        From the other post, I couldn't say what specifically would be causing the high memory use based on the description. I reviewed the files but it does appear there is quite a bit of logic in there to test. Also, there are two indicators here which add to the complexity.

        What I would likely suggest in this case would be to first find a situation where you can easily reproduce this problem. After locating that situation, it would probably be easiest to take away logic until the problem is no longer present. By take away logic, I just mean to slowly comment out portions of the script to locate the logic causing the high memory use.

        Once the problematic logic is located, this could then be extracted out of your existing scripts into a new test script and that could be used to reproduce/test the problem. If it is not apparent why that syntax is causing memory use, we could look at that together to find out why.

        From the files, I don't see anything you need to be disposing of to answer the question in the other thread.

        I look forward to being of further assistance.
        JesseNinjaTrader Customer Service

        Comment


          #5
          Originally posted by NinjaTrader_Jesse View Post
          Hello,
          THANK YOU AGAIN ! ! ! I will check things.

          Comment

          Latest Posts

          Collapse

          Topics Statistics Last Post
          Started by stafe, 04-15-2024, 08:34 PM
          6 responses
          30 views
          0 likes
          Last Post stafe
          by stafe
           
          Started by adeelshahzad, Today, 03:54 AM
          4 responses
          25 views
          0 likes
          Last Post adeelshahzad  
          Started by merzo, 06-25-2023, 02:19 AM
          10 responses
          823 views
          1 like
          Last Post NinjaTrader_ChristopherJ  
          Started by frankthearm, Today, 09:08 AM
          5 responses
          17 views
          0 likes
          Last Post NinjaTrader_Clayton  
          Started by jeronymite, 04-12-2024, 04:26 PM
          3 responses
          43 views
          0 likes
          Last Post jeronymite  
          Working...
          X