Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Testing OHLC, pivots and session breaks

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

    Testing OHLC, pivots and session breaks

    I come back with my favorite subject, as I want NT to display daily pivots.

    (1)

    Just to start with: Pivots are still far away from being displayed correctly, for example today for ER2H8 I get the following values

    -----------------NinjaTrader ----- other software ----- CME website
    ----------------(with IB data) ---- (with IB data) ------(Pivot calcul.)

    Main Pivot -------- 724,6 ------------ 725,37 ----------- 725,17
    Support S1 ------- 715,4 ------------ 716,93 ----------- 716,84
    Support S2 ------- 710,4 ------------ 712,06 ----------- 712,17

    The CME pivots were calculated from official high, low and close as published for yesterday. So there is a small error that comes from IB data ($10 to $ 20 per contract) and a large error that comes from the pivot formula used by NinjaTrader ($ 70 to $ 170 per contract).

    Problem: Although NT 6.5.8 has a new fetaure of sessions, the Pivot indicator does not use it. It needs to be redone.

    (2)

    Also dependent on sessions are Open, High, Low and Close

    The PriorDay and CurrentDay OHLC indicator now refer to session times, as you can see on the chart, but the logic is not yet consistent. I will take ER2H8 again. Current Open would be displayed

    on a 1 minute chart 722,0
    on a 10 minute chart 722,7
    on a 30 minute chart 723,3

    which is not good enough, as the open should be the same for all timeframes.

    (3) I would also prefer that the volume zones indicator displayed volume zones that refer to a specific session rather than to the visible part of the chart.

    So here is my question:

    Has anybody already programmed daily pivots that work and that take into account trading sessions? Or does anybody have an idea how to modify the pivots indicator to take into account session times - I am thinking of having parameters for session begin and session end that I would have to add to the pivots indicator.

    Thanks for any suggestions!

    #2
    Hi Harry,

    Regarding pivots, I suspect you have read it but if you have not, please see the following.



    In 6.5, we added user defined OHLC inputs that will be used for calculating the pivots if not blank.

    Regarding session times, our pivot indicators Prior and Current day have always worked off session times and work as expected.

    For verification -

    - I opened a 1 min chart of ER2 03-08
    - Session time is 7:30 to 2:15 (Mountain Time)
    - Applied current and prior day indicators
    - Changed the chart to 5 different intervals and the indicator values are always consistently the same
    RayNinjaTrader Customer Service

    Comment


      #3
      Hi Ray,

      thanks for your answer. Of course I know to calculate pivots and have also read your document.

      The user defined inputs for HLC work, but with 3 charts displayed (different time frames) this means that every time I want to display a new instrument I must enter 9 values under indicator settings that I first have to collect at the exchange's website. This is not a solution. I want one for all define session times and then get my pivots accordingly.

      Off-session pivots are more or less useless, which I tried to show with the example.

      For the Current Open, please enter session times into your chart. Take the American index futures session, which is

      Session begin 16:30 ET, Session end 16:15 ET

      The current OHL indicator refers to the session break (see NinajScript), but does produce different values for current open, if you change the BarsPeriod.Value....

      Please try again.

      Comment


        #4
        Thanks for clarifying the issue with the open price. This should not happen and we will check into it.

        Thanks.
        RayNinjaTrader Customer Service

        Comment


          #5
          Hi Ray,

          I just explored the error, and I now understand it. As explained in NT reference SessionBreak is true for the first call of a bar within a new session.

          If I set session begin = 22:30 and session end = 22:15 (CET), for a 10 min bar the first session bar should be the bar from 22:30 to 22:40. If you look at the screenshot, you will see that NinjaTrader chooses the bar from 22:20 to 22:30 to be the first session bar. As displayed in the databox, the open of the 22:20 bar is 722,7 which becomes the CurrentOpen.

          However, the CurrentOpen should have been taken from the next bar that opens down at 722.

          So this means that there is a 1 bar logical error within the definition of the sessionbreak or the session times. Should be easy to correct.
          Attached Files
          Last edited by Harry; 02-05-2008, 01:17 PM.

          Comment


            #6
            Thanks for the extra work. We have figured out what the issue is and it will be resolved for our next update.

            Thanks again for reporting this.
            RayNinjaTrader Customer Service

            Comment


              #7
              Bar time stamps to be aligned with session begin?

              Got some more questions related to OHLC and Pivots.

              How to collect the session close, when programming an indicator?

              If I chose the common timeframe of 60 min. and want to display the Session Close of ES/YM/NQ at 16:15 ET , it would simply not be included in the bar data, because it will be hidden somewhere in the bar timestamped 17:00 ET. So I cannot get it.

              One possibility would be to add another Bars object with a 5 min. Period and use it to calculate OHLC and Pivots, but I understood that the Add() method does not work within indicators?

              Or one would have to shift the 60 min. bars by 30 min thus having them stamped at 16:30, 17:30. But of course this shifting should only be done for those instruments that need it. For other markets this would be counterproductive.

              Did you ever think about adjusting all bars on an intraday chart to the session begin? This should be done for all instruments, actually most of the futures would stay time stamped at the full hour, only American Index Futures and Interest Rate futures would shift to 0:30. This shows again that you need to define sessions by instrument! This solution would also allow to correctly display OHLC and Pivots on 120 min, 180 min and 240 min charts...

              My question: Is there any way I can simulate this within an indicator for Pivots by adding a timespan to the timestamp of the current bar, or by calling a second data series?

              Actually I already thought about changing my system time to something odd, but I am afraid this will more confuse than help me.

              Comment


                #8
                Would GetSessionBar() help?

                RayNinjaTrader Customer Service

                Comment


                  #9
                  Session bar would help, if I do not have to use the session times from the properties panel, but define my own session times.

                  So is there any way to define variables to overwrite session begin and end? What is the underlying data type for session begin and end?

                  Also how can I check within the Initialize() method, which is the current instrument? I am thinking of something like

                  if (masterinstrument.name == "ES") sessionbegin = beginCmei;

                  where beginCmei would contain the hours and minutes of session begin for CME index futures. This way I could enter session begin times for all different futures contracts. If I do that in the Initialize method, it should not slow down the indicator too much, even if there is a whole load of instruments...

                  Comment


                    #10
                    Unfortunately there are no variables to do this.
                    RayNinjaTrader Customer Service

                    Comment


                      #11
                      Defining sessions within the indicator

                      Hi Ray,

                      do you see any other solution?

                      How can I check the current instrument?

                      Comment


                        #12
                        Maybe I am not understanding you.

                        Independant of time frame, if you GetSessionBar() you can retrieve the close price of the prior session. I take it, this is *not* what you want?

                        If not, what close price did you want?

                        To check for instrument in Initialize()

                        if (Instrument != null && Instrument.MasterInstrument.Name == "ES")
                        // Do something

                        If in OnBarUpdate(), you do not need to check for null reference.
                        RayNinjaTrader Customer Service

                        Comment


                          #13
                          Hi Ray,

                          thanks for your reply. Sorry for being not clear. I'll try again.

                          I am using 3 timeframes for the same instrument, connected to DOM. At the moment Pivots and OHLC indicators of NT do not work properly. OHLC uses session breaks, but there is still a bug. Pivot does not use session break, so I would have to enter session HLC manually into each of my charts.

                          If I switch instruments, I then have to enter 9 HLC values or 6 session time values. If I trade YM and want to have a look at ZB and then switch back to YM, this means entering 12 values somewhere in the indicator menu. Not practical at all.

                          So I want one indicator to display daily pivots correctly, even if I am changing an instrument.

                          So for ES the close price is taken at 4:15 PM ET because ES closes at 4:15 PM ET, but for ZB I the close price is taken at 5:00 PM ET because the CME interest markets close at 5:00 PM ET, and so on...

                          So I want simply to write down the session times into the intialize section of the indicator (there are only 7 to 8 liquid futures markets), then check, which is the master instrument, to which market it belongs and define the session time in the Initialize() section.

                          Then I want to calculate Pivots according to the session times. So I would need to get the Close at 4:15 PM for ES and the Close at 5:00 PM for ZB within the OnBarUpdate method().

                          So I am stuck.

                          Of course I could define the pivots in a similar way it has been done in the now existing indicator. But I would then have the problem that the 4:15 PM close is somewhere hidden in a bar, if bar period > 15 min.

                          The only solution I see now, is to enter the session for Globex Index Futures into the chart porperties, use the GetSessionBar only for Globex index futures and the traditional method (as exposed now in the Pivots indicator) for the other markets, because all other future markets are closed at 6 PM. This requires that my PC be set to CET to make 6PM ET a daybreak..... some sort of cheating.

                          More elegant solution: Use Add() - does not work, or overwrite session begin and end - does not work either.

                          Ray, do you understand my problem? I am just looking for a way to get NT to display session OHLC and pivots for all instruments correctly. Other software I am using already does it, so it is nothing new or special. Just NT does not yet provide the logic to do so.
                          Last edited by Harry; 02-06-2008, 02:25 PM.

                          Comment


                            #14
                            Yes, I completely understand.

                            - The bug will be fixed for the next update
                            - However, this does not solve your issue
                            - You are thinking out of the box on how to solve this problem which is good but the approach you are taking will not work since the session info is based on the underlying chart object and will not work if you try to change things in an indicator's Initialize()
                            - At this time, we just do not support session times at the instrument level which is what you need --> This is on our list for later this year.
                            - I have no other solution other than to create an indicator that gets the data (session OHLC) from some internet source...thus you would make an HTTP webrequest etc...
                            RayNinjaTrader Customer Service

                            Comment


                              #15
                              How to get OHLC values?

                              So while waiting for session times at the instrument level I will try to adopt this strange solution that works with some restrictions (max. period = 60 min) but would be fine for me.

                              Session begin = 4:30pm session end 4:15, can be used for index futures. Modify daybreak line to 5:00 PM or 6:00 PM for the other futures by maintaining the logic of the current indicator.

                              Do you know any data provider that would supply OHLC via webrequest? If not otherwise, could be useful to check data calculated via GetSessionBar()!

                              Comment

                              Latest Posts

                              Collapse

                              Topics Statistics Last Post
                              Started by jaybedreamin, Today, 05:56 PM
                              0 responses
                              3 views
                              0 likes
                              Last Post jaybedreamin  
                              Started by DJ888, 04-16-2024, 06:09 PM
                              6 responses
                              18 views
                              0 likes
                              Last Post DJ888
                              by DJ888
                               
                              Started by Jon17, Today, 04:33 PM
                              0 responses
                              1 view
                              0 likes
                              Last Post Jon17
                              by Jon17
                               
                              Started by Javierw.ok, Today, 04:12 PM
                              0 responses
                              9 views
                              0 likes
                              Last Post Javierw.ok  
                              Started by timmbbo, Today, 08:59 AM
                              2 responses
                              10 views
                              0 likes
                              Last Post bltdavid  
                              Working...
                              X