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

Seeking Guidance Regarding Use of Dispose with BarsRequest

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

    Seeking Guidance Regarding Use of Dispose with BarsRequest

    I'm running NinjaTrader Version 8.0.22.2 64-bit with a NinjaScript Add On that I've developed. My Add On makes use of the BarsRequest class, and I want to make sure I'm using it as required and intended. In particular, I want to make sure my NinjaScript does a good job of freeing up resources (especially memory) when a BarsRequest instance is no longer needed.

    The IntelliSense feature of the NinjaScript Editor shows that BarsRequest exposes a Dispose method. This suggests to me that my NinjaScript code should call Dispose for a BarsRequest instance when that instance is no longer needed. I've read through the BarsRequest section of the NinjaTrader 8 Help Guide and, while that section doesn't discuss the Dispose method, the Examples code therein does use the Dispose method in the Cleanup procedure.

    Please provide guidance regarding if and when I should use Dispose in conjunction with BarsRequest in my NinjaScript code; thank you.

    #2
    Hello NtFan,

    Thank you for your post.

    Yes, you should always be calling Dispose for cleanup when the instance is no longer needed, as in the example in the help guide. For the most part anything that can be disposed should be disposed on cleanup/termination.

    SharpDX brushes are the exception as these should be created/disposed in OnRender or OnRenderTargetChange.

    Please let us know if we may be of further assistance to you.

    Kate W.NinjaTrader Customer Service

    Comment

    Latest Posts

    Collapse

    Topics Statistics Last Post
    Started by alifarahani, Today, 09:40 AM
    4 responses
    20 views
    0 likes
    Last Post alifarahani  
    Started by gentlebenthebear, Today, 01:30 AM
    3 responses
    16 views
    0 likes
    Last Post NinjaTrader_Jesse  
    Started by PhillT, Today, 02:16 PM
    2 responses
    7 views
    0 likes
    Last Post PhillT
    by PhillT
     
    Started by Kaledus, Today, 01:29 PM
    3 responses
    11 views
    0 likes
    Last Post NinjaTrader_Jesse  
    Started by frankthearm, Yesterday, 09:08 AM
    14 responses
    47 views
    0 likes
    Last Post NinjaTrader_Clayton  
    Working...
    X