Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Regular and extended hour close and open

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

    Regular and extended hour close and open

    Hi, is there a way to plot both the regular hour close and open and the extended hour close and open on a chart? Thanks.

    #2
    Hi tffmd, thanks for posting.

    It depends on how you would want to do it. This could be done without using NinjaScript indicators by adding a second instrument of the same type and setting the session template to the RTH template, that would display both candlestick charts on the same window.

    To complete this through an Indicator script, you would use AddDataSeries(), using an overload that takes a tradingHoursName parameter to load the same instrument with a different trading hours template. Then you can plot the price as an indicator line. See here for a guide on a multi time frame scripts.

    Best regards,
    -ChrisL

    Comment


      #3
      Hi Thanks for your response. Option 2 would be the way to accomplish what I am looking for. Only problem is, I have no experience coding such a script. Would you be able to point me to the steps necessary to learn what I would need to accomplish this? Thanks. Tom

      Comment


        #4
        Hi Tom thanks for your reply.

        I have given you links in my previous reply for a guide on multi time frame scripts. If you are a beginner to Ninjascript, I recommend going through all of the material listed in this forum post for starting out:
        https://ninjatrader.com/support/foru...sample-scripts

        Best regards,
        -ChrisL

        Comment


          #5
          Perhaps an easier way to accomplish this would be a script that simply marks the opening print at 09:30 and closing print at 16:00. Is there a way to do that?

          Comment


            #6
            Hi, thanks for your reply.

            It can be done by running the script on a 1, 5, 10, 15, or 30 minute chart, and evaluating the Times[0][0]:

            Code:
            if (Times[0][0].TimeOfDay == new TimeSpan(9, 30, 0))
            {
               //Beginning of Session
            }
            
            if (Times[0][0].TimeOfDay == new TimeSpan(16, 0, 0))
            {
              //End of Session
            }
            This can also be built in the strategy builder:
            https://ninjatrader.com/support/help...imeComparisons

            Best regards,
            -ChrisL

            Comment


              #7
              Hi, thanks for your help. Would this be only for the current day? Ideally, the 9:30 print and 16:00 print from the previous day would be displayed as well as the 09:30 print from the current day. Thanks.

              Comment


                #8
                Hello tffmd123,

                NinjaScripts process OnBarUpdate bar-by-bar, so the conditions would be checked with each bar. If the strategy is run on multiple days, these conditions would also be checked and would not have to become true on the current day. This can be tested by placing Print(Time[0]); in the conditions Chris provided.

                We look forward to assisting.

                Comment

                Latest Posts

                Collapse

                Topics Statistics Last Post
                Started by Geovanny Suaza, 02-11-2026, 06:32 PM
                0 responses
                589 views
                0 likes
                Last Post Geovanny Suaza  
                Started by Geovanny Suaza, 02-11-2026, 05:51 PM
                0 responses
                342 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
                555 views
                1 like
                Last Post Geovanny Suaza  
                Started by RFrosty, 01-28-2026, 06:49 PM
                0 responses
                552 views
                1 like
                Last Post RFrosty
                by RFrosty
                 
                Working...
                X