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 Mindset, 04-21-2026, 06:46 AM
        0 responses
        97 views
        0 likes
        Last Post Mindset
        by Mindset
         
        Started by M4ndoo, 04-20-2026, 05:21 PM
        0 responses
        141 views
        0 likes
        Last Post M4ndoo
        by M4ndoo
         
        Started by M4ndoo, 04-19-2026, 05:54 PM
        0 responses
        68 views
        0 likes
        Last Post M4ndoo
        by M4ndoo
         
        Started by cmoran13, 04-16-2026, 01:02 PM
        0 responses
        125 views
        0 likes
        Last Post cmoran13  
        Started by PaulMohn, 04-10-2026, 11:11 AM
        0 responses
        76 views
        0 likes
        Last Post PaulMohn  
        Working...
        X