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 llanqui, Today, 03:53 AM
          0 responses
          6 views
          0 likes
          Last Post llanqui
          by llanqui
           
          Started by burtoninlondon, Today, 12:38 AM
          0 responses
          10 views
          0 likes
          Last Post burtoninlondon  
          Started by AaronKoRn, Yesterday, 09:49 PM
          0 responses
          15 views
          0 likes
          Last Post AaronKoRn  
          Started by carnitron, Yesterday, 08:42 PM
          0 responses
          11 views
          0 likes
          Last Post carnitron  
          Started by strategist007, Yesterday, 07:51 PM
          0 responses
          14 views
          0 likes
          Last Post strategist007  
          Working...
          X