Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Daily bars. Exit on close. Example please

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

    Daily bars. Exit on close. Example please

    I have a daily strategy that I would like to close at the end of the session (4:15pm) instead of the open the next day. Can someone give me a good example of how to do this?

    I have it programmed to send me an email, but it doesn't occur until the open the next day. I would like this to take place at session close so I can place an order for open the next day.

    Thanks,
    eleven

    #2
    Hello eleven,

    Thank you for your post.

    You can use ExitOnClose and ExitOnCloseSeconds. For information please visit the following links:

    Please let me know if you have any questions.

    Comment


      #3
      Thanks Patrick. ExitOnClose() looks like it will close all open positions.

      Sometimes my strategy closes at end of session and sometimes it holds for 2 or more days.

      I've been looking on the forum for how to do this and it looks like there are more than one solution. What is the most straight forward way to program close at exit if my strategy triggers? This will not happen every day however.

      Thanks

      Comment


        #4
        Hello,
        Thanks for the reply.

        You would need to check and create logic that tracks if your strategy is triggered. This will depend on the condition that you would like to have it trigger the close on.

        Likely you'll need to make ExitOnClose = false, but add a position check at a specified time. If the position is not flat at that time, close position.

        Here is a link to the help guide for MarketPostion and ToTime. You can use these set up your condition to check the position and the time to determine if you close your position or not.

        http://www.ninjatrader.com/support/h...etposition.htm

        http://www.ninjatrader.com/support/h...tml?totime.htm

        Please let us know if we may be of further assistance for anything NinjaTrader.
        Alex G.NinjaTrader Customer Service

        Comment


          #5
          Thanks Alex. I know how to program this.

          Will I need minute data for this or will the free end of day data feed work?

          Comment


            #6
            Hello eleven,
            Thanks for the reply.

            It depends on how you intend to test your strategy.

            End of day data will allow you to back test. However, the end of day data will not allow you to run this strategy live and would require a connection that updates live.

            Please let us know if we may be of further assistance for anything NinjaTrader.
            Alex G.NinjaTrader Customer Service

            Comment

            Latest Posts

            Collapse

            Topics Statistics Last Post
            Started by Geovanny Suaza, 02-11-2026, 06:32 PM
            0 responses
            558 views
            0 likes
            Last Post Geovanny Suaza  
            Started by Geovanny Suaza, 02-11-2026, 05:51 PM
            0 responses
            324 views
            1 like
            Last Post Geovanny Suaza  
            Started by Mindset, 02-09-2026, 11:44 AM
            0 responses
            101 views
            0 likes
            Last Post Mindset
            by Mindset
             
            Started by Geovanny Suaza, 02-02-2026, 12:30 PM
            0 responses
            545 views
            1 like
            Last Post Geovanny Suaza  
            Started by RFrosty, 01-28-2026, 06:49 PM
            0 responses
            547 views
            1 like
            Last Post RFrosty
            by RFrosty
             
            Working...
            X