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 SalmaTrader, 07-07-2026, 10:26 PM
      0 responses
      31 views
      0 likes
      Last Post SalmaTrader  
      Started by CarlTrading, 07-05-2026, 01:16 PM
      0 responses
      19 views
      0 likes
      Last Post CarlTrading  
      Started by CaptainJack, 06-17-2026, 10:32 AM
      0 responses
      9 views
      0 likes
      Last Post CaptainJack  
      Started by kinfxhk, 06-17-2026, 04:15 AM
      0 responses
      17 views
      0 likes
      Last Post kinfxhk
      by kinfxhk
       
      Started by kinfxhk, 06-17-2026, 04:06 AM
      0 responses
      20 views
      0 likes
      Last Post kinfxhk
      by kinfxhk
       
      Working...
      X