Announcement

Collapse
No announcement yet.

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 jerminedop, Today, 12:18 AM
    0 responses
    5 views
    0 likes
    Last Post jerminedop  
    Started by cnzaxtoil, Yesterday, 11:38 PM
    0 responses
    4 views
    0 likes
    Last Post cnzaxtoil  
    Started by cnzaxtoil, Yesterday, 11:37 PM
    0 responses
    3 views
    0 likes
    Last Post cnzaxtoil  
    Started by sukhob, Yesterday, 04:27 PM
    1 response
    14 views
    0 likes
    Last Post zacharydw00  
    Started by Bmnaiorwsd, Yesterday, 07:52 PM
    0 responses
    4 views
    0 likes
    Last Post Bmnaiorwsd  
    Working...
    X