Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Catching termination of strategy...

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

    Catching termination of strategy...

    Hi,

    Is there anything I can do, to execute some clean-up code when my strategy is *terminated*? Some kind of global finalize?

    The problem is I'm using the .NET FileSystemWatcher class, so I can monitor changes to one of my configuration file. If I modify a file, my strategy real-time reloads some parameters, etc.

    When I terminate the strategy, I'd like to stop monitoring the configuration file. So far, haven't seen a way of doing that.

    #2
    Hi heech, I think the method you're looking for is Dispose().
    AustinNinjaTrader Customer Service

    Comment


      #3
      Originally posted by NinjaTrader_Austin View Post
      Hi heech, I think the method you're looking for is Dispose().
      That's it! Thank you sir.

      Comment


        #4
        Hi Heech, Austin,

        Recalling my memory I would say that Dispose() is only called when you remove the strategy.

        If my memory is correct: Once a strategy gets flat after a trade the strategy has realized P/L and (true?) start/stop cell becomes stopped.

        But to call Dispose() one must manually remove the strategy.


        So maybe you should monitor the change of the cells start/stop or realized P/L of the strategies' row in the grid?
        You can do this, you must get access to the SourceGrid2
        strategyGridDisplay1
        (possible, but undocumented) and then you can add a IBehaviorModel to the cell in question. (look through sourcegrid2.dll) . OnValueChanged(..) is a good place to put your stop filesystemwatcher code.

        best regards
        Andreas

        Comment


          #5
          Originally posted by zweistein View Post
          Hi Heech, Austin,

          Recalling my memory I would say that Dispose() is only called when you remove the strategy.
          You are exactly right. I've just tested this. For my purposes for now, I will just be sure to "remove strategy".

          I'd love to hear more about these undocumented features though, if you've built up a collection of similar things we can automate! Any clever ways to programmatically disconnect/reconnect, or start a new strategy, for example?

          Comment


            #6
            with NT7 coming soon I think one should concentrate on other parts in the strategy logic. Undocumented features will definetely change.


            For example I have added a parameters dialog ( pops up when clicking the strategy's parameter cell) where I can change the strategy parameters after the strategy has already started.

            Comment

            Latest Posts

            Collapse

            Topics Statistics Last Post
            Started by Geovanny Suaza, 02-11-2026, 06:32 PM
            0 responses
            590 views
            0 likes
            Last Post Geovanny Suaza  
            Started by Geovanny Suaza, 02-11-2026, 05:51 PM
            0 responses
            342 views
            1 like
            Last Post Geovanny Suaza  
            Started by Mindset, 02-09-2026, 11:44 AM
            0 responses
            103 views
            0 likes
            Last Post Mindset
            by Mindset
             
            Started by Geovanny Suaza, 02-02-2026, 12:30 PM
            0 responses
            555 views
            1 like
            Last Post Geovanny Suaza  
            Started by RFrosty, 01-28-2026, 06:49 PM
            0 responses
            552 views
            1 like
            Last Post RFrosty
            by RFrosty
             
            Working...
            X