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 charlesugo_1, 05-26-2026, 05:03 PM
          0 responses
          49 views
          0 likes
          Last Post charlesugo_1  
          Started by DannyP96, 05-18-2026, 02:38 PM
          1 response
          141 views
          0 likes
          Last Post NinjaTrader_ChelseaB  
          Started by CarlTrading, 05-11-2026, 05:56 AM
          0 responses
          160 views
          0 likes
          Last Post CarlTrading  
          Started by CarlTrading, 05-10-2026, 08:12 PM
          0 responses
          96 views
          0 likes
          Last Post CarlTrading  
          Started by Hwop38, 05-04-2026, 07:02 PM
          0 responses
          275 views
          0 likes
          Last Post Hwop38
          by Hwop38
           
          Working...
          X