Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Exit On Close

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

    Exit On Close

    I have a problem with a trade entering after the exit on close but before the session end. Is there a quick way to tell if within the exitoncloseseconds window for the current session, or if not, is there a quick way to detect how far I am from the end of the session.

    (or should I override exitonclose, call the base one, set a flag and reset it start of next session?)

    thanks
    Dave

    #2
    Hello Dave,

    Unfortunately I am not sure if I completely follow. When 'Exit on close' is enabled in your strategy, all open positions will be closed on the last bar of the session.

    Are you referring to NinjaScript - a way to display the remaining time using custom coding?


    Unfortunately there is no default option that will display the remaining time.

    Comment


      #3
      Thanks Jason,

      Yes, I understand exactly what exit on close does. AFTER it has fired however, my strategy enters a trade which does not get closed on session close, presumably because exit on close does not fire again right at the end, which is expected since I have exitoncloseseconds set to 600. I need to know somehow to stop that trade from entering.

      Comment


        #4
        dave1992,

        ExitOnClose does not prevent you from re-entering your position again. You should program a time filter into your strategy that effective says "no more trading" at the same time your ExitOnClose triggers. For an example of setting up a time filter, please see here: http://www.ninjatrader.com/support/f...ead.php?t=3226
        Josh P.NinjaTrader Customer Service

        Comment


          #5
          Josh,

          I understand all that. Exit on Close and the seconds variable are useful because they are related to a session, which may change. Time filters do not.

          Looking back at the questions in my OP, can you override exitonclose? Is there any way of obtaining the session end time?

          thanks
          Dave

          Comment


            #6
            Hi Dave, you could program your own ExitOnClose handling and grab the applied template begin / end time with this - http://www.ninjatrader.com/support/h...xtbeginend.htm

            Comment


              #7
              Thanks, that's exactly what I need. I just call that and subtract the seconds from the session end time.

              Comment

              Latest Posts

              Collapse

              Topics Statistics Last Post
              Started by Geovanny Suaza, 02-11-2026, 06:32 PM
              0 responses
              605 views
              0 likes
              Last Post Geovanny Suaza  
              Started by Geovanny Suaza, 02-11-2026, 05:51 PM
              0 responses
              351 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
              560 views
              1 like
              Last Post Geovanny Suaza  
              Started by RFrosty, 01-28-2026, 06:49 PM
              0 responses
              561 views
              1 like
              Last Post RFrosty
              by RFrosty
               
              Working...
              X