Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

ExitOnClose = false is not working

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

    ExitOnClose = false is not working

    Hello,

    In my script in the Initialize() function, I have ExitOnClose = false.

    However, when I run a backtest, it still sells all of my shares on the last day before it exits. I would like for the backtest to terminate with open positions. Otherwise, it messes up the statistics for my automated strategy.

    I've added a couple of screenshots to show you what is happening.

    Any help would be much appreciated. I'm at a loss here.
    Attached Files

    #2
    Hello bswerd,

    Thank you for your post.

    In your strategy backtest parameters, what do you have the Order Properties 'Time in force' set to? Day or GTC?

    What session template are you testing this on?
    MatthewNinjaTrader Product Management

    Comment


      #3
      Thanks for the fast reply!

      There's no change whether I pick 'GTC' or 'Day' for 'Time in Force'. GTC is my default.

      I'm using the Default 24/7 session template (In my Session Manager anyways... maybe it's using a different one for backtesting?)

      Thanks for your help.

      Comment


        #4
        Hello,


        Thank you for your note.



        The Exit On Close is still getting executed, I suspect that when you start the strategy or run a back test when setting up the parameters please make double sure it is set to false here. Then run the back test one more time still occurs?

        I look forward to assisting you further.

        Comment


          #5
          Yes. It is most definitely set to False.

          Attached are my backtesting settings.
          Attached Files

          Comment


            #6
            Hello,

            Thanks for the confirmation.

            I would want to look into this then, as I understand it you can only duplicate this with your strategy and the sampleMACrossOver strategy does not have this issue.

            Please send the strategy to support at ninjatrader dot com ATTN: Brett and reference this forum thread. The strategy will only be used once for testing.

            I look forward to assisting you further.

            Comment


              #7
              I just ran the SampleMACrossOver strategy on this. It also exits all of your positions on close despite having 'Exit on Close' set to False.

              Attached is a screenshot of the Trades made by SampleMACrossOver. You can see that it Exits a Short position on close despite having ExitOnClose set to false.

              I never said that this worked for SampleMACrossOver.
              Attached Files

              Comment


                #8
                Hello,

                What version of NinjaTrader are you using?

                I look forward to assisting you further.

                Comment


                  #9
                  7.0.1000.7, Simulation Only at this point.

                  Thanks for your continued support.

                  Comment


                    #10
                    Hello,

                    In this case I will want to login toy our PC as not sure why this is occurring at this point we would need to run some tests.

                    Can you please provide your phone number so that I may call you.

                    Also, Can you please run the following program and let me know the ID and password that is generated.

                    Comment


                      #11
                      What may be happening here is just the last exit on close. If there are any open positions on the last bar of data, these are closed and the signal name indicated is Exit On Close. Having it set to false should still prevent the normal end of session exit on close.
                      Ryan M.NinjaTrader Customer Service

                      Comment


                        #12
                        Originally posted by NinjaTrader_RyanM View Post
                        What may be happening here is just the last exit on close. If there are any open positions on the last bar of data, these are closed and the signal name indicated is Exit On Close. Having it set to false should still prevent the normal end of session exit on close.
                        Yes, that's precisely what the problem is.

                        Sorry, I cannot take a phone call or remote help right now. Is this a known problem? Can you reproduce it on your strategies? I'm using a pretty vanilla installation of NinjaTrader, so if other people aren't experiencing this, then I just need that magic setting that says:

                        "Please don't exit positions on session end."

                        If there is no easy solution now that you understand precisely what the issue is, then I will have to schedule a phone call some other time when I have a better sense of my schedule.

                        Thanks for your continued support. This seems like a really weird problem to me too.

                        Comment


                          #13
                          Hello,

                          This is actually expected with NinjaTrader and currently no way to change.

                          Any open position are closed at the last bar of data for performance reporting and is expected.

                          Let me know if I can be of further assistance.

                          Comment


                            #14
                            That's some weird functionality, no?

                            If I'm going to test an automated, always-on strategy then I want to know how well it does during a window of time.

                            Can we have this be a feature request? It feels like some pretty strange behaviour.

                            The system shouldn't be selling any shares without me specifically stating when.

                            Thanks for your help.

                            Comment


                              #15
                              Hello,

                              I will contact development and have them added to the feature request list.

                              Thank You!

                              Comment

                              Latest Posts

                              Collapse

                              Topics Statistics Last Post
                              Started by frankthearm, Today, 09:08 AM
                              5 responses
                              14 views
                              0 likes
                              Last Post NinjaTrader_Clayton  
                              Started by jeronymite, 04-12-2024, 04:26 PM
                              3 responses
                              43 views
                              0 likes
                              Last Post jeronymite  
                              Started by yertle, Today, 08:38 AM
                              5 responses
                              16 views
                              0 likes
                              Last Post NinjaTrader_BrandonH  
                              Started by adeelshahzad, Today, 03:54 AM
                              3 responses
                              19 views
                              0 likes
                              Last Post NinjaTrader_BrandonH  
                              Started by bill2023, Yesterday, 08:51 AM
                              6 responses
                              27 views
                              0 likes
                              Last Post NinjaTrader_Erick  
                              Working...
                              X