Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Exit on close

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

    Exit on close

    Hi,
    I have the following script, but it didn't seem to work for holiday hours? Anything else needs to be included?
    Code:
    ExitOnClose = true;
    ExitOnCloseSeconds = 900;
    Thanks

    #2
    This property returns true if the strategy will exit on close; otherwise, false. Your Strategy has to be added(function) for 'ExitOnclose' to work

    Last edited by Emma1; 11-23-2018, 01:25 PM.

    Comment


      #3
      Hello 2Look4me,

      Thanks for your post.

      NinjaTrader 7 Session Templates do not define holiday trading hours so ExitOnSession close will not have an earlier time to exit.

      NinjaTrader 8 Trading Hours templates do have holiday hours included and will exit at the holiday session close.

      If you would like to have this behavior done programmatically with NinjaTrader 7, the script must know when the new Exit On Session Close time should be and the strategy should take those actions on its own.

      Please let us know if we can be of further assistance.

      Comment


        #4
        Thanks Jim for the prompt reply. Something along this line?

        if (ToDay(Time[0]) == 20181123 && ToTime(Time[0]) >= 115000 && Position.MarketPosition != MarketPosition.Flat)
        {
        if ( Position.MarketPosition == MarketPosition.Long )
        {
        ExitLong();
        }
        else
        {
        ExitShort();
        }
        }

        Comment


          #5
          Hello 2Look4me,

          Yes, this would be a valid time check which will exit your open position once an iterating bar has a time stamp after 11:50:00.

          Let us know if there is anything else we can do to help.

          Comment

          Latest Posts

          Collapse

          Topics Statistics Last Post
          Started by CarlTrading, 03-31-2026, 09:41 PM
          1 response
          134 views
          1 like
          Last Post NinjaTrader_ChelseaB  
          Started by CarlTrading, 04-01-2026, 02:41 AM
          0 responses
          75 views
          1 like
          Last Post CarlTrading  
          Started by CaptainJack, 03-31-2026, 11:44 PM
          0 responses
          119 views
          2 likes
          Last Post CaptainJack  
          Started by CarlTrading, 03-30-2026, 11:51 AM
          0 responses
          114 views
          1 like
          Last Post CarlTrading  
          Started by CarlTrading, 03-30-2026, 11:48 AM
          0 responses
          92 views
          0 likes
          Last Post CarlTrading  
          Working...
          X