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 CaptainJack, 05-29-2026, 05:09 AM
      0 responses
      239 views
      0 likes
      Last Post CaptainJack  
      Started by CaptainJack, 05-29-2026, 12:02 AM
      0 responses
      155 views
      0 likes
      Last Post CaptainJack  
      Started by charlesugo_1, 05-26-2026, 05:03 PM
      0 responses
      164 views
      1 like
      Last Post charlesugo_1  
      Started by DannyP96, 05-18-2026, 02:38 PM
      1 response
      247 views
      0 likes
      Last Post NinjaTrader_ChelseaB  
      Started by CarlTrading, 05-11-2026, 05:56 AM
      0 responses
      199 views
      0 likes
      Last Post CarlTrading  
      Working...
      X