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 kschuble, Today, 01:16 PM
    1 response
    9 views
    0 likes
    Last Post omololu
    by omololu
     
    Started by wooofad, Today, 11:34 AM
    0 responses
    15 views
    0 likes
    Last Post wooofad
    by wooofad
     
    Started by tonynt, Today, 10:06 AM
    1 response
    19 views
    0 likes
    Last Post bltdavid  
    Started by Kediil, Yesterday, 09:26 AM
    2 responses
    35 views
    0 likes
    Last Post Kediil
    by Kediil
     
    Started by mr_trade, Today, 08:41 AM
    0 responses
    18 views
    0 likes
    Last Post mr_trade  
    Working...
    X