• If this is your first visit, you will have to register before you can post. To view messages, please scroll below and select the forum that you would like to visits. Questions? Be sure to check out the Forum FAQ.

Announcement

Collapse
No announcement yet.

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.
      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.
      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 tvaughan4, Yesterday, 10:46 PM
                  2 responses
                  13 views
                  0 likes
                  Last Post tvaughan4  
                  Started by digibob, Yesterday, 10:01 PM
                  3 responses
                  11 views
                  0 likes
                  Last Post digibob
                  by digibob
                   
                  Started by ldissinger, Today, 12:55 PM
                  1 response
                  11 views
                  0 likes
                  Last Post ldissinger  
                  Started by pstrusi, Today, 09:06 AM
                  1 response
                  24 views
                  0 likes
                  Last Post marcus2300  
                  Started by vpzdcv, Today, 02:31 AM
                  0 responses
                  13 views
                  0 likes
                  Last Post vpzdcv
                  by vpzdcv
                   
                  Working...
                  X