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.
        BrettNinjaTrader Product Management

        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.
            BrettNinjaTrader Product Management

            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.
                BrettNinjaTrader Product Management

                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.

                    http://www.ninjatrader.com/remotesupport
                    BrettNinjaTrader Product Management

                    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.
                          BrettNinjaTrader Product Management

                          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!
                              BrettNinjaTrader Product Management

                              Comment

                              Latest Posts

                              Collapse

                              Topics Statistics Last Post
                              Started by wjadevries, Today, 03:35 PM
                              1 response
                              7 views
                              0 likes
                              Last Post NinjaTrader_ChrisL  
                              Started by Mykro, Today, 03:59 PM
                              0 responses
                              4 views
                              0 likes
                              Last Post Mykro
                              by Mykro
                               
                              Started by venkateshdvk, Today, 01:34 PM
                              1 response
                              21 views
                              0 likes
                              Last Post NinjaTrader_Kate  
                              Started by westofpluto, Today, 01:54 PM
                              1 response
                              7 views
                              0 likes
                              Last Post NinjaTrader_Jesse  
                              Started by zacharydw00, Today, 02:11 PM
                              4 responses
                              15 views
                              0 likes
                              Last Post zacharydw00  
                              Working...
                              X