Announcement

Collapse

Looking for a User App or Add-On built by the NinjaTrader community?

Visit NinjaTrader EcoSystem and our free User App Share!

Have a question for the NinjaScript developer community? Open a new thread in our NinjaScript File Sharing Discussion Forum!
See more
See less

Partner 728x90

Collapse

fnding market close and open times

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

    fnding market close and open times

    I am trying to find the market close and open times for instruments. the reason is my drawing objects group up in that area. If i know the open and close of the times I will add it to my indicator.

    #2
    Hello,
    Thanks for your post.

    By using GetNextBeginEnd, you can access the session begin/end times being used for each unique instrument that you are charting.
    https://ninjatrader.com/support/help...xtbeginend.htm

    Along with the GetNextBeginEnd help guide article above, you may want to check out the MSDN page for DateTime as well. I am including a link to that page below.
    https://msdn.microsoft.com/en-us/library/xcfzdy4x.aspx

    Please let me know if you have any further questions.
    Josh G.NinjaTrader Customer Service

    Comment


      #3
      Originally posted by NinjaTrader_Josh View Post
      Hello,
      Thanks for your post.

      By using GetNextBeginEnd, you can access the session begin/end times being used for each unique instrument that you are charting.


      Along with the GetNextBeginEnd help guide article above, you may want to check out the MSDN page for DateTime as well. I am including a link to that page below.


      Please let me know if you have any further questions.
      There will be gotchas along the way if you (or someone using your indicator)
      uses a Session Template other than <Use instrument settings>.

      I mean, using "Default 24/7" seems common, but doing so means
      GetNextBeginEnd will return the time equivalent to midnight in New,
      York (ie, midnight from Eastern time zone adjusted to your local time
      zone) as the session close DateTime.

      If you use a multi-session Session Template (as needed sometimes
      for Harry's, aka "FatTails" on futures.io, session indicators), these
      templates return different values for GetNextBeginEnd, depending
      which hour of the multiple defined sessions you're "inside of".

      NinjaTrader support, is this correct?

      Isn't GetNextBeginEnd completely dependent upon the session
      template in use?

      Comment


        #4
        Hello,

        You are correct. Unfortunately, there is no way to set the Session template in your strategy using NinjaScript. So, using GetNextBeginEnd would be entirely dependent on the Session Template that is selected when the strategy is applied.

        Please let me know if you have any further questions.
        Josh G.NinjaTrader Customer Service

        Comment


          #5
          Interesting but for a basic user to find when the market closes IE MST 1500 and Opens at 1600 GetNextBeginEnd is the best solution. What I have to do is find the close and truncate that 1 hour time when I draw. I have rays and sometimes my Anchors lie in that close hour. Also I have noticed in financials NQ there is a 15 minute hole. Is that common and if so what is a common solution in printing around these times

          Comment


            #6
            Hello ballboy,

            Unfortunately, there is not a way to check for gaps in data through NinjaScript. I would not say that gaps are a particularly common occurrence, but it does happen from time to time. That being said, we would like to know more information about the gap that you experienced in your data. Please write into our support team at PlatformSupport(at)NinjaTrader(dot)com with this item so that we can check on this for you.
            Josh G.NinjaTrader Customer Service

            Comment


              #7
              i was wondering if you can look at the code sample I am close but I still have some line issues

              public DateTime EndOfDayWeekendConversion(DateTime tTimeToCheck)
              {



              if(tTimeToCheck.DayOfWeek == DayOfWeek.Friday && sessionBegin.Hour <= tTimeToCheck.Hour )
              {
              tTimeToCheck = tTimeToCheck.AddHours(50);
              }
              else if(sessionBegin.Hour == tTimeToCheck.Hour)
              {

              tTimeToCheck = tTimeToCheck.AddHours(1);






              return tTimeToCheck;
              }



              What it does is supposed to bypass the weekend and start drawing on sunday open or in that area AND if it is a weekday jump an hour .

              the timestamp is recorded so it needs to check only once.

              Comment


                #8
                Hi ballboy11,

                What are the error messages you are getting?

                Is sessionBegin set to a valid time (and does not have a null value)?
                Chelsea B.NinjaTrader Customer Service

                Comment


                  #9
                  Originally posted by ballboy11 View Post
                  What it does is supposed to bypass the weekend and start drawing on sunday open or in that area AND if it is a weekday jump an hour .
                  But is that really necessary? I mean, come market close on
                  a Friday, there are no bars to worry about until Sunday's open.

                  Your code simply will not run until bars appear, so if left to run
                  over the weekend, it does nothing -- but this is considered
                  completely normal.

                  For ex, no indicator in bin/Custom/Indicators cares about the
                  weekend break, yet they all look "visually continuous" come
                  session open on Sunday.

                  Just my 2˘.

                  Comment

                  Latest Posts

                  Collapse

                  Topics Statistics Last Post
                  Started by Irukandji, Today, 09:34 AM
                  1 response
                  3 views
                  0 likes
                  Last Post NinjaTrader_Clayton  
                  Started by RubenCazorla, Today, 09:07 AM
                  1 response
                  5 views
                  0 likes
                  Last Post RubenCazorla  
                  Started by TraderBCL, Today, 04:38 AM
                  3 responses
                  25 views
                  0 likes
                  Last Post NinjaTrader_Jesse  
                  Started by WeyldFalcon, 08-07-2020, 06:13 AM
                  11 responses
                  1,423 views
                  0 likes
                  Last Post jculp
                  by jculp
                   
                  Started by BarzTrading, Today, 07:25 AM
                  2 responses
                  29 views
                  1 like
                  Last Post BarzTrading  
                  Working...
                  X