Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

The "Exit on close" time

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

    #16
    Originally posted by NinjaTrader_Bertrand View Post
    Hi ju1234,

    This cannot be set individually for each symbol.

    Please look into this link http://www.ninjatrader-support.com/H...itOnClose.html

    and use the 'ExitOnClose = True' command in your Initialize section, this will allow to use the session endling times then to flatten your positions.

    Please also review this link here - http://www.ninjatrader-support2.com/...ead.php?t=3226
    I used the following code so that my trade will exit 1 min before session close. But it does not seem to execute when I do the backtest? I ran the backtest on a 5 min timeframe.

    protected override void Initialize()
    {
    // Triggers the exit on close function 60 seconds prior to session end
    ExitOnClose = true;
    ExitOnCloseSeconds = 60;
    }

    Also the Exit on Close method, is it placed as a market order? Or is it placed as a market on close order. I use IB for my brokerage.
    Last edited by tjendra; 03-25-2009, 05:34 AM.

    Comment


      #17
      It would be a market order to get you flat. Did you also try this with the per default installed SampleMACrossover strategy? Did you follow the suggestions in this thread to sync up your PC clock?

      Comment


        #18
        When you said sync up your PC clock, do you mean:

        1. Right-click your clock, and then click Adjust Date/Time.
        2. Click the Internet Time tab. Click the Server down arrow, and then click time.windows.com 3. Click Update Now. Windows XP contacts the Internet time server and sets your clock.

        Also, I can't input those code into the default installed SampleMACrossover strategy right?

        Comment


          #19
          Yes, this is what I meant - if you start the SampleMACrossover you see the ExitOnClose function is already built in.

          Comment


            #20
            My SampleMACrossover strategy does not have the ExitOnClose function already built in. And my problem is not that my strategy doesn't exit on close. It is ExitOnCloseSeconds = 60 function doesn't work as I want it to exit 1 min before close.

            Comment


              #21
              Not sure I follow tjendra. All strategies have ExitOnClose options available to them in the strategy selection dialogue as you start it up. If you feel the exit order is not placed you will need to debug it with TraceOrders = true to see if the order actually went through and what happened to the order if not filled.
              Josh P.NinjaTrader Customer Service

              Comment


                #22
                Josh, I thought Bertrand mean there was this code ExitOnClose = true; inside the SampleMACrossOver strategy which I didn't find. I understand that ExitOnClose options available in the strategy selection dialogue as it start up. What I wanted to do is to hardcode it inside my strategy and also for ExitOnCloseSeconds = 60 so that it exit 1 min before close.

                Comment


                  #23
                  If you wanted it in the code you will have to add it. By default there are no settings for it. These are what you can set: http://www.ninjatrader-support2.com/...06&postcount=5
                  Josh P.NinjaTrader Customer Service

                  Comment


                    #24
                    That's what I did, I added ExitOnClose = true; and ExitOnCloseSeconds = 60; in my strategy and it didn't work.

                    Also if the ExitOnClose options is set to false in the strategy selection dialogue, even if you hardcode ExitOnClose = true; in your strategy, it still won't exit on close.

                    Comment


                      #25
                      tjendra,

                      The option you select on the Strategy selection dialogue is the final set. What you hard code is a default that is overwritten by the selection dialogue. Please ensure the selection dialogue is set to true.

                      If all is set properly, then you will need to use TraceOrders = true to see what is happening with that order.
                      Josh P.NinjaTrader Customer Service

                      Comment

                      Latest Posts

                      Collapse

                      Topics Statistics Last Post
                      Started by Geovanny Suaza, 02-11-2026, 06:32 PM
                      0 responses
                      627 views
                      0 likes
                      Last Post Geovanny Suaza  
                      Started by Geovanny Suaza, 02-11-2026, 05:51 PM
                      0 responses
                      359 views
                      1 like
                      Last Post Geovanny Suaza  
                      Started by Mindset, 02-09-2026, 11:44 AM
                      0 responses
                      105 views
                      0 likes
                      Last Post Mindset
                      by Mindset
                       
                      Started by Geovanny Suaza, 02-02-2026, 12:30 PM
                      0 responses
                      562 views
                      1 like
                      Last Post Geovanny Suaza  
                      Started by RFrosty, 01-28-2026, 06:49 PM
                      0 responses
                      567 views
                      1 like
                      Last Post RFrosty
                      by RFrosty
                       
                      Working...
                      X