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

Amending OHLC Pit Session Indicator

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

    Amending OHLC Pit Session Indicator

    Hi,

    Wonder if any of you can help me.

    I have a pit session OHL/C for current and prior day - It plots session OHLC for a defined pit session even when on 24hour Globex charts.

    It works OK but I have to allow for an offset of the chart bar period when inputting the start/end time. This is a bit of a pain when I change the period of a chart, because I have to then go into the indicator and change the setting, then change back when I change the chart period back...

    As an example, if the pit opens at 0900 and closes at 1430, and I am on a 5minute chart, I have to input 0905 as the open time and 1435 as the close time, if I am on a 1minute chart then I have to input 0901 and 1431 etc etc - I would prefer being able to simply input the correct actual times, then I could freely change chart period without amending the indicator settings each time.

    Can some sort of offset be put into the code? So that the code accounts for the charts period of bar automatically.

    Appreciate it if someone can help me do this. Thank-you
    Attached Files

    #2
    For dealing with that problem, I have coded indicators based on both an offset and a modified session template. The problem with introducing an offset is that you will often get overlapping bars, for example a bar that starts at 8:57 AM and ends at 9:01 AM. In that case current high and low cannot be determined correctly. I have therefore settled for a modified session template.

    For example, I have subdivided the session template for CL into three sessions

    night session: 6:00 PM EST to 9:00 AM EST
    regular session: 9:00 AM EST to 2:30 PM EST
    evening session: 2:30 PM EST to 5:15 PM EST

    The CurrentDayOHL indicator may calculate OHL from any of the three sessions or from the full Globex session. I have further added a few options

    - dynamic fib lines based on the current high and low
    - noise bands (breakout bands, comparable to Toby Crabels stretch)
    - target bands based on the average daily range (average daily range based on one of the three sessions or the full session)

    The chart below shows open, high and low for yesterday's regular session of CL 10-13. Also have a look at the noise bands which allow to determine the upper and lower breakout points, as well as the target bands which are based on the average range of the regular session. The average range for CL over the last 5 days was 1.39 points, over the last 10 days it was 1.61 points. The target bands are used on the mean of those two values, the upper target band is obtained by adding the average range of the regular session to the current day's low.

    The indicator is available in the download section (search for SessionPivots).
    Attached Files

    Comment


      #3
      I also use that session template for calculating floor pivots from the regular session. For yesterday's close I use the settlement price from daily data as required. The indicator also shows the prior day's high and low and calculates the pivot range.

      The method is pretty convenient. Each instrument uses its own session template, which is preset via the instrument manager. My charts always use the session template <instrument settings>.

      If I toggle from CL 10-13 to ES 09-13, the session template will be automatically modified, this allowing me to display correct OHL values and floor pivots for each instrument. If you use an offset, you will have to enter those values manually, whenever you toggle between instruments. With the subdivided session template, the problem is solved once for ever, and you do not need to bother anymore about the session specifications.
      Attached Files

      Comment


        #4
        Hello ScottieDog,

        Thank you for your post.

        You can use BarsPeriod to check the PeriodType and Value. The example below shows how to set variables based on the BarsPeriod:
        Code:
            if (BarsPeriod.Id == PeriodType.Minute && BarsPeriod.Value == 1)
            {
                mySessionStart = 90100;
            }
            else if (BarsPeriod.Id == PeriodType.Minute && BarsPeriod.Value == 5)
            {
                mySessionStart = 90500;
            }
        For information on BarsPeriod please visit the following link: http://www.ninjatrader.com/support/h...barsperiod.htm

        Please let me know if I may be of further assistance.

        Comment


          #5
          Originally posted by Harry View Post

          For example, I have subdivided the session template for CL into three sessions

          night session: 6:00 PM EST to 9:00 AM EST
          regular session: 9:00 AM EST to 2:30 PM EST
          evening session: 2:30 PM EST to 5:15 PM EST

          Thanks Harry. Very interesting. I like the idea of them auto changing if I change instrument too, great stuff.

          How do I sub divide the session template? I guess I add a new one but then how will that relate to the "use instrument settings" which will chose one of the defaults, won´t it?

          Comment


            #6
            Originally posted by ScottieDog View Post
            Thanks Harry. Very interesting. I like the idea of them auto changing if I change instrument too, great stuff.

            How do I sub divide the session template? I guess I add a new one but then how will that relate to the "use instrument settings" which will chose one of the defaults, won´t it?
            .
            (1) Create new session templates for all instruments that you wish to trade and select those session templates as default templates under instrument settings.

            (2) Open all charts with instrument settings.

            Example: For CL I use the session template attached. Session templates should ALWAYS use exchange time (for proper handling of different daylight savings schedules).
            Attached Files

            Comment


              #7
              Thank-you Harry.

              Gottit! It was the save as default in "instrument manager" that I was missing. Thanks again.


              EDIT: All set up and absolutely fantastic. Now I can change period of chart and the numbers are right, AND I can change instrument and not have to change anything too.

              THANKS Harry. Great stuff.
              Last edited by ScottieDog; 09-04-2013, 11:32 AM.

              Comment


                #8
                Just wondering. Does it use many resources, this indicator series? Ninja is taking much longer to load the charts than normal.

                Thanks for everything!

                Comment


                  #9
                  Originally posted by ScottieDog View Post
                  Just wondering. Does it use many resources, this indicator series? Ninja is taking much longer to load the charts than normal.

                  Thanks for everything!
                  The indicators are ultra-fast and should load within milliseconds. The pivots indicator requires that you first load daily data into your daily data base.

                  Comment


                    #10
                    Yes. Restarted the computer then Ninja again and they loaded quick sharp! Thanks.

                    Comment


                      #11
                      I was reading some of your other posts and I thought I saw that you coded one of these with the Value Area included.

                      I can´t find reference to it now, could you point me to the one with VA included please?

                      Comment


                        #12
                        Originally posted by ScottieDog View Post
                        I was reading some of your other posts and I thought I saw that you coded one of these with the Value Area included.

                        I can´t find reference to it now, could you point me to the one with VA included please?
                        The Session Pivots come with a value area based on the central pivot and floor pivot of the prior day - the pivot range (it is created by mirroring yesterday's midline around the main floor pivot PP). For more information on the pivot range, see "The Logical Trader" by Mark Fisher.

                        Value area is more a concept related to market profile. The "market profile" approach for the value area is based on the mode of the price volume distribution of the regular session, which is called "point of control". Starting with the mode a value area is determined that covers about 70% of the volume traded. You can find the rules for calculating the value area high and low in Appendix 1 of the book "Mind Over Markets" by Jim Dalton.

                        Alternatively it is possible to calculate a value area based on

                        -> the current day's VWAP/TWAP and standard deviation bands
                        -> the current day's Median and percentile bands

                        I have indicators available for all different approaches to calculating the value area, for both TPO and VWTPO calculations. The indicators based on the VWAP/TWAP and SD bands are available here:

                        The best futures trading community on the planet: futures trading, market news, trading charts, trading platforms, trading strategies

                        The best futures trading community on the planet: futures trading, market news, trading charts, trading platforms, trading strategies

                        The best futures trading community on the planet: futures trading, market news, trading charts, trading platforms, trading strategies

                        The best futures trading community on the planet: futures trading, market news, trading charts, trading platforms, trading strategies

                        The best futures trading community on the planet: futures trading, market news, trading charts, trading platforms, trading strategies

                        The best futures trading community on the planet: futures trading, market news, trading charts, trading platforms, trading strategies


                        The other indicators will be published soon.

                        Comment


                          #13
                          Hi Harry,

                          Regarding the "anaPivotsDailyv42" I would like to change the names of some of the labels. Notably the labels for Y-High/Low/Close - I found these names in the code on lines 221 - 223 and I added my own label name there instead, I then compiled... But the labels are still the same as the ones you defined...

                          I searched the entire code and can´t find any other reference to the label "Y-High"

                          Is there somewhere else I should be changing the name labels?

                          All the best.

                          Comment


                            #14
                            Isn´t this where the label is defined?

                            Code:
                            Add(new Plot(new Pen(Color.Gray,1), PlotStyle.Line,"Y-High "));

                            Comment


                              #15
                              Originally posted by ScottieDog View Post
                              Hi Harry,

                              Regarding the "anaPivotsDailyv42" I would like to change the names of some of the labels. Notably the labels for Y-High/Low/Close - I found these names in the code on lines 221 - 223 and I added my own label name there instead, I then compiled... But the labels are still the same as the ones you defined...

                              I searched the entire code and can´t find any other reference to the label "Y-High"

                              Is there somewhere else I should be changing the name labels?

                              All the best.
                              Changing the label names on lines 221 to 223 will do what you look for. Try again. If it does not work, post a screenshot, please.

                              Comment

                              Latest Posts

                              Collapse

                              Topics Statistics Last Post
                              Started by funk10101, Today, 12:02 AM
                              1 response
                              10 views
                              0 likes
                              Last Post NinjaTrader_LuisH  
                              Started by GLFX005, Today, 03:23 AM
                              1 response
                              6 views
                              0 likes
                              Last Post NinjaTrader_Erick  
                              Started by nandhumca, Yesterday, 03:41 PM
                              1 response
                              12 views
                              0 likes
                              Last Post NinjaTrader_Gaby  
                              Started by The_Sec, Yesterday, 03:37 PM
                              1 response
                              11 views
                              0 likes
                              Last Post NinjaTrader_Gaby  
                              Started by vecnopus, Today, 06:15 AM
                              0 responses
                              1 view
                              0 likes
                              Last Post vecnopus  
                              Working...
                              X