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

Camarilla Pivots questions

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

    Camarilla Pivots questions

    Hello,
    I'm trying to use Camarilla Pivots in my strategy, and I'm having a couple issues.
    I'm using it like this:
    CamarillaPivots(PivotRange.Daily, HLCCalculationMode.DailyBars, 0, 0, 0, 20)

    Core issue... I just get back 0 (zero) for S1[0], S2[0], R1[0], R2[0], etc.

    The docs say to use ".Pp.IsValidDataPoint(0)" in order to "ensure you are accessing accurate values", but there is no ".Pp" definition available, or even a mention of what it is suppose to be checking (if it did exist).

    For some background, my strategy is running on a 3min chart. I'm loading the daily series, if that makes a difference, with:
    AddDataSeries(BarsPeriodType.Day, 1)

    And I'm calling the CamarillaPivots() method in my OnBarUpdate() method, when BarsInProgress is the daily series, and when IsFirstTickOfBar is true. (Maybe one of these things is the issue???)

    Thanks for any help!



    #2
    Hello GregX999,

    Thank you for your post.

    From the Help Guide:

    "When using HLCCalculationMode.DailyBars it can be expected that a value of 0 is returned when the daily bars have not been loaded yet. Due to the asynchronous nature of this indicator calling daily bars you should only access the pivot values when the indicator has loaded all required Bars objects. To ensure you are accessing accurate values you can use .IsValidDataPoint() as a check:"




    When you call IsValidDataPoint(), you can check one of the defined plots like S1 or R2.

    Code:
    CamarillaPivots(PivotRange.Daily, HLCCalculationMode.DailyBars, 0, 0, 0, 20).S1.IsValidDataPoint(0)
    We have made a note to update our Help Guide as Pp is not a plot for this indicator, we apologize for any confusion.

    Please let us know if we can assist further.
    Gaby V.NinjaTrader Customer Service

    Comment


      #3
      Hi Gaby,
      Thanks for the help. I'm still struggling to get it to work however.

      In my OnUpdateBars() method, I have the following...

      Code:
      if (_camarillaPivots == null)
          _camarillaPivots = CamarillaPivots(PivotRange.Daily, HLCCalculationMode.DailyBars, 0, 0, 0, 20);
      
      if (!_camarillaPivots.R1.IsValidDataPoint(0))
          Print("Waiting for CamarillaPivots...");​
      When I run it, it just prints "Waiting for CamarillaPivots..." every bar update (which is set to OnPriceChange). It seems R1 never becomes valid.

      I know my strategy has loaded the daily bar series that it added by this point as other Print statements I'm using for other things confirm that. (Does the Camarilla Pivots use it's own set of daily bars that it loads itself, or does it use the data series I add in my script? My strategy is running on a 3min chart, but IS loading a daily data series as well.)

      Thanks

      Comment


        #4
        Hello,

        Can you test adding Camarilla Pivots to a daily chart using PivotRange.Daily and HLCCalculationMode.DailyBars?

        After adding it to the chart, check the message at the bottom of the chart and let me know what it says.

        I look forward to your response.
        Gaby V.NinjaTrader Customer Service

        Comment


          #5
          Originally posted by NinjaTrader_Gaby View Post
          After adding it to the chart, check the message at the bottom of the chart and let me know what it says.
          It says "Daily bars require the use of Weekly or Monthly Pivot range."
          Click image for larger version

Name:	image.png
Views:	99
Size:	81.0 KB
ID:	1286032

          Comment


            #6
            Hello GregX999,

            Thank you for your response.

            Since the indicator is using daily bars to calculate the pivot, then the bar interval needs to be greater than a day.

            For the pivot to be calculated intraday, the pivot needs intraday data to calculate.

            Since you can't use both HLCCalculationMode.DailyBars and PivotRange.Daily, this is why you are not getting valid data points.
            Gaby V.NinjaTrader Customer Service

            Comment


              #7
              Hi Gaby,
              Thanks for the explanation.

              I just decided to code my own Camarilla pivots right into my strategy since I already have the daily bars loaded as a data series. It ended up only taking a few minutes to do once I looked up the formula to do it.

              I guess the built-in one is a bit overly-complex for my use case, since it has to work on its own, as well as in all different types of strategies.

              Comment

              Latest Posts

              Collapse

              Topics Statistics Last Post
              Started by reynoldsn, Yesterday, 07:11 PM
              3 responses
              14 views
              0 likes
              Last Post NinjaTrader_BrandonH  
              Started by manueldecastro, Today, 10:26 AM
              2 responses
              12 views
              0 likes
              Last Post manueldecastro  
              Started by i2ogu3, Yesterday, 11:31 PM
              4 responses
              22 views
              0 likes
              Last Post i2ogu3
              by i2ogu3
               
              Started by cmtjoancolmenero, 04-29-2024, 03:40 PM
              23 responses
              70 views
              0 likes
              Last Post NinjaTrader_Jesse  
              Started by reynoldsn, Yesterday, 04:40 PM
              3 responses
              14 views
              0 likes
              Last Post NinjaTrader_Gaby  
              Working...
              X