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 Mindset, 04-21-2026, 06:46 AM
      0 responses
      57 views
      0 likes
      Last Post Mindset
      by Mindset
       
      Started by M4ndoo, 04-20-2026, 05:21 PM
      0 responses
      78 views
      0 likes
      Last Post M4ndoo
      by M4ndoo
       
      Started by M4ndoo, 04-19-2026, 05:54 PM
      0 responses
      39 views
      0 likes
      Last Post M4ndoo
      by M4ndoo
       
      Started by cmoran13, 04-16-2026, 01:02 PM
      0 responses
      101 views
      0 likes
      Last Post cmoran13  
      Started by PaulMohn, 04-10-2026, 11:11 AM
      0 responses
      61 views
      0 likes
      Last Post PaulMohn  
      Working...
      X