Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

how to detect (eliminate) holidays?

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

    how to detect (eliminate) holidays?

    So I can use the example in "Strategy: Using a time filter to limit trading hours" to permanently exclude weekends (Sat/Sun).

    But how do I exclude other non-trading days during an historical analysis?
    Specifically holidays & half-days....

    My other charting packages either automatically exclude holidays, or provide a software level option to exclude them (and clearly idenitfy what days are considered holidays to the user).

    Real-time, I can use my head -- but in a strategy running on historical data, the code has to know which Mon-Fri days are not truly full market days. How?

    #2
    You would need to cover this by custom coding, since NT does not provide a calender logic at this time.

    Comment


      #3
      So even though I've read that NT does not acknowledge holidays -- it appears that they ARE eliminated by NT code already when running a strategy backtest.

      I ran this and the holidays were not listed...
      protected override void OnBarUpdate()
      { if (Bars.SessionBreak) Print(ToDay(Time[0]) ); }

      From previous replies, several of us had the impression that there was no holiday handling in NT. Is it just that you do not want to tell us which days are coded as holidays?

      Comment


        #4
        There is no holiday handling in NT. If OnBarUpdate() was not called on a Holiday it was because your historical data set did not have any data on that specific day.
        RayNinjaTrader Customer Service

        Comment


          #5
          Since there is no simple way around this, I would just like to put a "!=holidaydate."

          By that I mean, I would like to insert a simple list of dates per each year I want to back test, and I will grab the list from CME's website. After all, it's only a handful of days I want to put in. Then put a != statement for each of these dates in a loop around my code.

          What is the syntax for saying, "If not equal to a given date?"

          Comment


            #6
            Originally posted by forrestang View Post
            Since there is no simple way around this, I would just like to put a "!=holidaydate."

            By that I mean, I would like to insert a simple list of dates per each year I want to back test, and I will grab the list from CME's website. After all, it's only a handful of days I want to put in. Then put a != statement for each of these dates in a loop around my code.

            What is the syntax for saying, "If not equal to a given date?"
            Gonna try this:
            Code:
            if (ToDay(Time[0]) == 20100101 || ToDay(Time[0]) == 20100118 || ToDay(Time[0]) == 20100215  || ToDay(Time[0]) == 20100402
            				|| ToDay(Time[0]) == 20100531 || ToDay(Time[0]) == 20100705 || ToDay(Time[0]) == 20100906 || ToDay(Time[0]) == 20101025
            				|| ToDay(Time[0]) == 20101026 || ToDay(Time[0]) == 20101029)
            				return;

            Comment


              #7
              That should do it forrestang, more dedicated holiday handling is on our suggested enhancements list already for consideration.

              Comment

              Latest Posts

              Collapse

              Topics Statistics Last Post
              Started by Geovanny Suaza, 02-11-2026, 06:32 PM
              0 responses
              646 views
              0 likes
              Last Post Geovanny Suaza  
              Started by Geovanny Suaza, 02-11-2026, 05:51 PM
              0 responses
              367 views
              1 like
              Last Post Geovanny Suaza  
              Started by Mindset, 02-09-2026, 11:44 AM
              0 responses
              107 views
              0 likes
              Last Post Mindset
              by Mindset
               
              Started by Geovanny Suaza, 02-02-2026, 12:30 PM
              0 responses
              569 views
              1 like
              Last Post Geovanny Suaza  
              Started by RFrosty, 01-28-2026, 06:49 PM
              0 responses
              573 views
              1 like
              Last Post RFrosty
              by RFrosty
               
              Working...
              X