Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Break at End of Week (Part 2)

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

    Break at End of Week (Part 2)

    Hello Ninjatrader staff,

    As per recommendation I will turn my question to the General Development section of the Ninjatrader Support Forum.
    Please read the short discussion that took place in this thread --> https://ninjatrader.com/support/foru...at-end-of-week

    I am looking forward to your reply.

    #2
    Hello GLFX005,

    Thank you for your post.

    Well, you wouldn't just be able to make a week long trading hours template as one big "trading day" because you can't create a trading day of more than 24 hours there. The Break at EOD field is readonly, so you couldn't dynamically change that within a script.

    Theoretically you could modify an existing bars type or make your own that has specific logic to only adjust for Break at EOD if it's a new week.

    I'd take a look at the example on this page:



    See where the example is checking for if(bars.IsResetOnNewTradingDay && isNewSession))?

    You could add logic to that to only perform that logic if we're on a new week. I wouldn't recommend just checking if time.DayOfWeek == DayOfWeek.Sunday as you could run into issues with holidays defined in trading hours templates, so you'd probably want to check what week of the year the new day falls in - if not the same as the previous time then let it do the usual Break at EOD logic.

    Here's some publicly available documentation from Microsoft on getting the week of year:



    Please let us know if we may be of further assistance to you.

    Comment


      #3
      Hello Kate,

      Thank you kindly for your detailed reply, the information you've provided me is very interesting.
      I will attempt to achieve my goal and let you know should I find a solution or any further problems.

      Have a good day!

      Comment


        #4
        Hi GLFX005,
        You could perhaps also try to identify a new week as follows:
        If the (int) value of the next trading day is lower than the (int) value of the current trading day, you have a new week. This assumes Monday = 1, Tuesday = 2, etc.
        NT-Roland

        Comment

        Latest Posts

        Collapse

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