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 rhyminkevin, Today, 04:58 PM
    3 responses
    48 views
    0 likes
    Last Post Anfedport  
    Started by iceman2018, Today, 05:07 PM
    0 responses
    5 views
    0 likes
    Last Post iceman2018  
    Started by lightsun47, Today, 03:51 PM
    0 responses
    7 views
    0 likes
    Last Post lightsun47  
    Started by 00nevest, Today, 02:27 PM
    1 response
    14 views
    0 likes
    Last Post 00nevest  
    Started by futtrader, 04-21-2024, 01:50 AM
    4 responses
    50 views
    0 likes
    Last Post futtrader  
    Working...
    X