Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Disable 'Exit on Close' in Strategy ?

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

    Disable 'Exit on Close' in Strategy ?

    hello,

    how do you disable 'exit on close' in a strategy ?

    I can disable this in the Strategy Analyzer, but when forward-testing the strategy in a chart, the chart shows that several trades exited on close.


    #2
    Just ExitOnClose to false when you launch the strategy for live trading then (found in Order Handling options) -

    http://www.ninjatrader.com/support/helpGuides/HelpGuideV6/RunningANinjaScriptStrategyFromAChart.html

    Comment


      #3
      thank you !

      Comment


        #4
        Another question:


        say that I run the Strategy for two days, and have open positions, and my computer is shut-off. The 'Exit' for the open orders is defined in the now-closed Strategy.

        I re-run the strategy a day or two later...


        Question:

        Can a Strategy deal with previously opened positions ?

        Comment


          #5
          Faspomy,

          When you restart your strategy it is a completely new instance of the strategy. It does not interact with anything you did before.
          Josh P.NinjaTrader Customer Service

          Comment


            #6
            NT Josh,

            thank you.


            Then will the open positions be closed as-per the Strategy (even if it is not running), or do the open positions need to be closed manually ?

            Comment


              #7
              Just right click in the chart > Strategies > select your strategy and set ExitOnClose to false in the order handling options of it -

              http://www.ninjatrader.com/support/helpGuides/HelpGuideV6/Images/NT6AutomatedTrading2png.png

              Comment


                #8
                Thank you NT Bertrand.


                One final question for this thread:

                Can I change the stoploss and takeprofit on positions which have already been opened ?

                For example, my strategy opened 5 positions. I closed the strategy with 3 positions still open. Can I manually set the takeprofit and stoploss for these open positions after the strategy is closed ?

                Comment


                  #9
                  You're welcome, yes after the strategy is closed down you could attach a stop and target for the 'naked' position -

                  http://www.ninjatrader.com/support/forum/showthread.php?t=6197

                  Comment


                    #10
                    Thank you !

                    Comment


                      #11
                      Ooopss--

                      still not clear about one thing:


                      can a strategy set-up a price for a position to exit at, even if the strategy is closed ?

                      for example:
                      you buy a position at 94.20 and want to sell at 94.65

                      the strategy is stopped before reaching your goal, and 'exit on close' was set to false. so the position is still open, and you are away at a wedding, and the price finally crosses 94.65.

                      can you set a price to sell a position, even if the strategy is closed, within the strategy ?

                      Comment


                        #12
                        Faspomy, depending on your settings, the order could persist or it could be cancelled when NinjaTrader is closed. Also, the manner in which NT is closed would also determine if the orders stay. The default setting (if NT closes gracefully, not shutdown unexpectedly) is to cancel orders when a strategy is disabled.

                        To make sure your orders stay around, you must disable that setting and specify a GTC order so it doesn't automatically get cancelled at the exchange at the end of the day.
                        Attached Files
                        AustinNinjaTrader Customer Service

                        Comment


                          #13
                          Thank you !

                          Comment


                            #14
                            Good Morning!

                            I need to dig up this thread, because I would like to disable the flag "exit on close" IN THE STRATEGY script itself. I often forget to turn this into "false" when starting the strategy so I want to hard-code it into the script.

                            Is there a (undocumented) function?

                            Thanks, Stefan!

                            Comment


                              #15
                              Yes, you can set ExitOnClose = false in your Strategy Initialize().

                              Comment

                              Latest Posts

                              Collapse

                              Topics Statistics Last Post
                              Started by Geovanny Suaza, 02-11-2026, 06:32 PM
                              0 responses
                              659 views
                              0 likes
                              Last Post Geovanny Suaza  
                              Started by Geovanny Suaza, 02-11-2026, 05:51 PM
                              0 responses
                              374 views
                              1 like
                              Last Post Geovanny Suaza  
                              Started by Mindset, 02-09-2026, 11:44 AM
                              0 responses
                              109 views
                              0 likes
                              Last Post Mindset
                              by Mindset
                               
                              Started by Geovanny Suaza, 02-02-2026, 12:30 PM
                              0 responses
                              574 views
                              1 like
                              Last Post Geovanny Suaza  
                              Started by RFrosty, 01-28-2026, 06:49 PM
                              0 responses
                              579 views
                              1 like
                              Last Post RFrosty
                              by RFrosty
                               
                              Working...
                              X