Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

unexpected behaviour in Trading Hours

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

    #16
    Hello fredfred,

    Thank you for your response.

    Calculate.OnBarClose would result in waiting for the bar to close to verify the ExitOnSessionClose. In the case of ExitOnSessionCloseSeconds set to 30 and the BarsType being 1 Minute we would not see the Exit attempted until after the session closed. So you would likely need to increase ExitOnSessionCloseSeconds to 90.

    Trading Hours template affects the data viewed for the strategy. Since you set the ExitOnSessionCloseSeconds to 30 any tick after that time can still open position. ExitOnSessionClose is to exit a position, not prevent new entries.

    Please let me know if I may be of further assistance.

    Comment


      #17
      Hello fredfred,

      I wanted to further provide an example that prevents trades after the exit on close.
      NinjaTrader Community, A common inquiry is that the Exit on close didn't work in a NinjaScript Strategy because there is a position after the exit on close should have occurred. When viewing the log we often find that the Exit on close does indeed exit the position shortly before the end of the session (based on the Exit on
      Chelsea B.NinjaTrader Customer Service

      Comment

      Latest Posts

      Collapse

      Topics Statistics Last Post
      Started by argusthome, 03-08-2026, 10:06 AM
      0 responses
      65 views
      0 likes
      Last Post argusthome  
      Started by NabilKhattabi, 03-06-2026, 11:18 AM
      0 responses
      41 views
      0 likes
      Last Post NabilKhattabi  
      Started by Deep42, 03-06-2026, 12:28 AM
      0 responses
      23 views
      0 likes
      Last Post Deep42
      by Deep42
       
      Started by TheRealMorford, 03-05-2026, 06:15 PM
      0 responses
      26 views
      0 likes
      Last Post TheRealMorford  
      Started by Mindset, 02-28-2026, 06:16 AM
      0 responses
      52 views
      0 likes
      Last Post Mindset
      by Mindset
       
      Working...
      X