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 CarlTrading, 03-31-2026, 09:41 PM
      1 response
      46 views
      0 likes
      Last Post NinjaTrader_ChelseaB  
      Started by CarlTrading, 04-01-2026, 02:41 AM
      0 responses
      22 views
      0 likes
      Last Post CarlTrading  
      Started by CaptainJack, 03-31-2026, 11:44 PM
      0 responses
      33 views
      1 like
      Last Post CaptainJack  
      Started by CarlTrading, 03-30-2026, 11:51 AM
      0 responses
      50 views
      0 likes
      Last Post CarlTrading  
      Started by CarlTrading, 03-30-2026, 11:48 AM
      0 responses
      42 views
      0 likes
      Last Post CarlTrading  
      Working...
      X