Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Why does the last bar of a session get closed on the next session open?

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

    Why does the last bar of a session get closed on the next session open?

    Why does the last bar of a session get closed on the next session open? It seems more logical for it to close at the end of the session.

    #2
    Hello cunparis,

    Unfortunately the last bar will only be closed until the next bar is created.

    This is by design.

    Comment


      #3
      Originally posted by NinjaTrader_Jason View Post
      Hello cunparis,

      Unfortunately the last bar will only be closed until the next bar is created.

      This is by design.
      I realize that it is intended to be that way, I'm just curious to know the reasoning behind it as I find it unintuitive.

      I had a strategy that I had "wait until flat" set to true and I ran it and it was showing a P/L in real time because it would have had an open position.. it kept showing the open profit until the next day. It seems it didn't do the exit on close. And that got me wondering why the bars are closed the following day.

      Comment


        #4
        "Wait until flat" means no real orders will be placed. The PnL you are seeing is the virtual strategy position PnL. It will remain there until it gets closed out by the strategy.

        "Exit on Close" works off of your session definitions. If you are on a 24 hour chart there is no exit till midnight. If you have no data at midnight, well, then there is no way to exit. I suggest you adjust your chart session definitions. I suggest you use TraceOrders = true to truly isolate out what is going on with your ExitOnClose order.

        Bars are closed when the next bar opens. If you have no data till the next day then it will take till the next day to close the previous bar.
        Josh P.NinjaTrader Customer Service

        Comment


          #5
          Originally posted by NinjaTrader_Josh View Post
          "Wait until flat" means no real orders will be placed. The PnL you are seeing is the virtual strategy position PnL. It will remain there until it gets closed out by the strategy.

          "Exit on Close" works off of your session definitions. If you are on a 24 hour chart there is no exit till midnight. If you have no data at midnight, well, then there is no way to exit. I suggest you adjust your chart session definitions. I suggest you use TraceOrders = true to truly isolate out what is going on with your ExitOnClose order.

          Bars are closed when the next bar opens. If you have no data till the next day then it will take till the next day to close the previous bar.
          I have my session set to 9:30 - 4:00. If I use exit on close, do they get closed at 3:59:30 or 9:29:30?

          It seems the virtual position in my strategy wasn't closed at 4:00 so I'm wondering what will happen with real money trading.

          Comment


            #6
            cunparis,

            3:59:30. Please use TraceOrders = true to see what was happening. Only then will you know if it was submitted, but too late or some other reason as to what might have caused it not to get filled.
            Josh P.NinjaTrader Customer Service

            Comment

            Latest Posts

            Collapse

            Topics Statistics Last Post
            Started by NullPointStrategies, Today, 05:17 AM
            0 responses
            50 views
            0 likes
            Last Post NullPointStrategies  
            Started by argusthome, 03-08-2026, 10:06 AM
            0 responses
            126 views
            0 likes
            Last Post argusthome  
            Started by NabilKhattabi, 03-06-2026, 11:18 AM
            0 responses
            69 views
            0 likes
            Last Post NabilKhattabi  
            Started by Deep42, 03-06-2026, 12:28 AM
            0 responses
            42 views
            0 likes
            Last Post Deep42
            by Deep42
             
            Started by TheRealMorford, 03-05-2026, 06:15 PM
            0 responses
            46 views
            0 likes
            Last Post TheRealMorford  
            Working...
            X