Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Should an indicator have a destructor?

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

    Should an indicator have a destructor?

    Is there a reason for an indicator class to have a destructor?

    I implemented one containing just a Print() statement. I found that it is eventually called. I did a bunch of NinjaScript refreshes of my chart and saw a lot of Terminates but no destructor call. After a bit of sitting while pondering the mysteries of NinjaTrader, the destructor printouts started happening. At this point, all of the objects' destructors did get called. I'm presuming that I was seeing caching and eventually a timeout, but I'm only guessing.

    The basic question: does an indicator ever need a destructor, or should all cleanup be done in Terminate and there be no destructor?

    #2
    A related question: should an indicator ever care about the undocumented state State.Finalize? I have noticed that is the State when the destructor is called.

    Comment


      #3
      So is the answer that no indicator class ever needs to include a destructor method?

      Comment

      Latest Posts

      Collapse

      Topics Statistics Last Post
      Started by Geovanny Suaza, 02-11-2026, 06:32 PM
      0 responses
      648 views
      0 likes
      Last Post Geovanny Suaza  
      Started by Geovanny Suaza, 02-11-2026, 05:51 PM
      0 responses
      369 views
      1 like
      Last Post Geovanny Suaza  
      Started by Mindset, 02-09-2026, 11:44 AM
      0 responses
      108 views
      0 likes
      Last Post Mindset
      by Mindset
       
      Started by Geovanny Suaza, 02-02-2026, 12:30 PM
      0 responses
      572 views
      1 like
      Last Post Geovanny Suaza  
      Started by RFrosty, 01-28-2026, 06:49 PM
      0 responses
      573 views
      1 like
      Last Post RFrosty
      by RFrosty
       
      Working...
      X