Announcement

Collapse

Looking for a User App or Add-On built by the NinjaTrader community?

Visit NinjaTrader EcoSystem and our free User App Share!

Have a question for the NinjaScript developer community? Open a new thread in our NinjaScript File Sharing Discussion Forum!
See more
See less

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.
      JimNinjaTrader Customer Service

      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.
          JimNinjaTrader Customer Service

          Comment

          Latest Posts

          Collapse

          Topics Statistics Last Post
          Started by RideMe, 04-07-2024, 04:54 PM
          5 responses
          28 views
          0 likes
          Last Post NinjaTrader_BrandonH  
          Started by f.saeidi, Today, 08:13 AM
          1 response
          5 views
          0 likes
          Last Post NinjaTrader_ChelseaB  
          Started by DavidHP, Today, 07:56 AM
          1 response
          6 views
          0 likes
          Last Post NinjaTrader_Erick  
          Started by kujista, Today, 06:23 AM
          3 responses
          10 views
          0 likes
          Last Post kujista
          by kujista
           
          Started by Mindset, Yesterday, 02:04 AM
          2 responses
          18 views
          0 likes
          Last Post NinjaTrader_RyanS  
          Working...
          X