Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Code for Strategy Stopped

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

    Code for Strategy Stopped

    Hello,

    Can someone please advise what event fires when I stop a strategy? For instance, if I Disable a running strategy or close the chart, what event gets fired?

    I want to add code to close any open positions and cancel any working orders should the strategy be stopped, but I am not sure where to place this code.

    Thank you.

    Isaac

    #2
    Hello ivb73077,

    When a strategy or indicator is disabled or removed, the OnTermination() method will be run.

    Below is a link to the help guide on OnTermination().
    http://www.ninjatrader.com/support/h...rmination2.htm
    Chelsea B.NinjaTrader Customer Service

    Comment


      #3
      Thank you.

      Will this event also fire if I simply close the chart to which a strategy is attached?

      Comment


        #4
        Hello ivb73077,

        Yes, this event will fire if a chart is closed with a strategy running on it.
        Chelsea B.NinjaTrader Customer Service

        Comment


          #5
          Great. Thanks.

          Comment

          Latest Posts

          Collapse

          Topics Statistics Last Post
          Started by CarlTrading, 03-31-2026, 09:41 PM
          1 response
          134 views
          1 like
          Last Post NinjaTrader_ChelseaB  
          Started by CarlTrading, 04-01-2026, 02:41 AM
          0 responses
          75 views
          1 like
          Last Post CarlTrading  
          Started by CaptainJack, 03-31-2026, 11:44 PM
          0 responses
          119 views
          2 likes
          Last Post CaptainJack  
          Started by CarlTrading, 03-30-2026, 11:51 AM
          0 responses
          114 views
          1 like
          Last Post CarlTrading  
          Started by CarlTrading, 03-30-2026, 11:48 AM
          0 responses
          92 views
          0 likes
          Last Post CarlTrading  
          Working...
          X