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

Zero Values for Pivot Points

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

    Zero Values for Pivot Points

    hi,

    first of all, let me say that i am new and happy to be here. i hope i am posting on the right topic.

    i am developing an indicator that uses pivots for a NT customer. i have a call in my code that references the PP array like so:

    Code:
    double pp = Pivots(PivotRange.Daily, HLCCalculationMode.DailyBars, 0, 0, 0, 20).PP[0];
    the indicator is running on a tick chart that is using Kinetic as the data source. i outputed the value of pp above to the log. from the log i see that for most of the bars, pp is zero. only for several of the most recent bars the value is non-zero. for these non-zero bars, the value is correct.

    any ideas/directions on why i might be getting zero values for these "historic" bars? any help/direction would be greatly appreciated.

    Onn

    #2
    Hi onn,

    Thanks for the post. Can you please let us know the version of NinjaTrader you're using? Check with Help > About. Do you otherwise see daily charts available?
    Ryan M.NinjaTrader Customer Service

    Comment


      #3
      thanks for following up so quickly Ryan - much appreciated,

      i am developing the indicator for someone else. i know that he is on version 7 but not sure about the exact build/subversion. i will check with him and get back if that makes a difference.

      also, i am not sure what you mean by "Do you see daily charts available".
      do you mean: can i switch from a tick to chart to daily chart on that same chart? or are you asking if i see the same behavior on a daily chart? or both?

      since i am new to the platform, perhaps it would help if you told me a specific action/test to perform and what i should expect to see and i will do so.

      ONn

      Comment


        #4
        hi,

        i managed to reproduce and reduce what i am seeing. i have a 1 min MSFT chart setup. when i add the Pivots study with default values, i can see the pivot lines on the chart just fine.
        i am running on NT 7.0.1000.5

        now, i created an indicator that has all but two lines of code in it:

        protected override void OnBarUpdate()
        {
        double pp = Pivots(PivotRange.Daily, HLCCalculationMode.DailyBars, 0, 0, 0, 20).PP[0];
        Print("CurrentBar: " + CurrentBar + " " + "PP: " + pp);
        }


        i pasted the output window below. notice that Bar 0 has non-zero value and that all subsequent bars are zero (i only pasted up to 17 but it goes on with zeros to the end).

        why are all the PP values coming out zero? i must be doing something wrong?


        CurrentBar: 0 PP: 25.67
        CurrentBar: 1 PP: 0
        CurrentBar: 2 PP: 0
        CurrentBar: 3 PP: 0
        CurrentBar: 4 PP: 0
        CurrentBar: 5 PP: 0
        CurrentBar: 6 PP: 0
        CurrentBar: 7 PP: 0
        CurrentBar: 8 PP: 0
        CurrentBar: 9 PP: 0
        CurrentBar: 10 PP: 0
        CurrentBar: 11 PP: 0
        CurrentBar: 12 PP: 0
        CurrentBar: 13 PP: 0
        CurrentBar: 14 PP: 0
        CurrentBar: 15 PP: 0
        CurrentBar: 16 PP: 0
        CurrentBar: 17 PP: 0
        Last edited by onnb1; 09-02-2011, 04:36 AM. Reason: forgot to put the version in

        Comment


          #5
          Onn, please try with the calculation mode set to use intraday data - with the daily bars a programmatic access would unfortunately not be possible here as the pivot indicator internally would load the bars asyncronously -

          BertrandNinjaTrader Customer Service

          Comment


            #6
            thanks. it looks much much better. so what is the difference from a functional level between using the intraday setting to the daily bar setting in call to Pivots? in what cases will i get different values between the two?

            is using the intraday setting on the pivots call giving me the same values i see visually when i add the Pivots study through the UI with the default values?

            Onn

            Comment


              #7
              Onn, the Pivots indicator from the UI would work with the daily setting, but you could not access it's value from another script on this setting, for this application (strategies for example) please work with the ones calculated from intraday data. They would then use the set session times in your applied session template for the trading hours.
              BertrandNinjaTrader Customer Service

              Comment


                #8
                i think i lost you on the last response. let me try and recap.

                this code won't work due to asynch working of NT. it explains the wildly inconsistent behavior i saw.

                Code:
                double pp = Pivots(PivotRange.Daily, HLCCalculationMode.DailyBars, 0, 0, 0, 20).PP[0];
                so i am using this code which works quite nicely

                Code:
                double pp = Pivots(PivotRange.Daily, HLCCalculationMode.CalcFromIntradayData, 0, 0, 0, 20).PP[0];
                but...the values i am getting with the call above are different than the values i get when i add the pivots study with it's defaults in the UI

                so i guess what i am asking is: is it possible to have the two aligned? is there a way to configure the session or the data series or what not so that what i see visually is what i am getting in the code?

                phew...hope this makes sense

                ONn

                Comment


                  #9
                  Onn, I would then change the indicator added in the charts to also calc from the intraday data, this means both the charted and strategy values work of the session templates times set for calculating the pivots.
                  BertrandNinjaTrader Customer Service

                  Comment


                    #10
                    thanks. changed them and it looks just fine now. you can see this issue closed. much appreciated.

                    ONn

                    Comment


                      #11
                      Glad to hear ONn. Thanks for letting me know here.
                      BertrandNinjaTrader Customer Service

                      Comment

                      Latest Posts

                      Collapse

                      Topics Statistics Last Post
                      Started by Stanfillirenfro, Today, 07:23 AM
                      5 responses
                      21 views
                      0 likes
                      Last Post NinjaTrader_ChelseaB  
                      Started by navyguy06, Today, 09:28 AM
                      1 response
                      6 views
                      0 likes
                      Last Post NinjaTrader_Gaby  
                      Started by DayTradingDEMON, Today, 09:28 AM
                      1 response
                      15 views
                      0 likes
                      Last Post NinjaTrader_ChelseaB  
                      Started by cmtjoancolmenero, Yesterday, 03:58 PM
                      8 responses
                      31 views
                      0 likes
                      Last Post NinjaTrader_ChelseaB  
                      Started by helpwanted, Today, 03:06 AM
                      2 responses
                      22 views
                      0 likes
                      Last Post NinjaTrader_LuisH  
                      Working...
                      X