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

Pivots - Intermediate (NT7)

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

    Pivots - Intermediate (NT7)

    I am using the standard NinjaTrader provided pivots which are usually sufficient.

    (I have modified it "RoundedToTickSize" which is useful for instruments such as 6J which shows much more decimals on the chart than on the DOM.)

    But sometimes the gap between these pivots is quite huge and some "intermediate" pivot lines in between PP and R1 and PP and S2 would be useful. I'd like to give it a go and create these and if there is interest for this I can then post the result in the files sharing section. Note this would be for NT7.

    I would appreciate if someone could tell me a good formula to calculate these mid-pivot lines? The standard ones are as follows.

    pp = (currentHigh + currentLow + currentClose) / 3;
    s1 = 2 * pp - currentHigh;
    s2 = pp - (currentHigh - currentLow);

    r1 = 2 * pp - currentLow;
    r2 = pp + (currentHigh - currentLow);

    sandman

    #2
    I got a formula for mid pivots and have used one for testing purposes. For NT7 that is. I inserted it into the code, it compiles with no errors but it does not show up any pivot at all.

    What can/should I do?

    What I did specifically is to take the original NT indicator Pivots, and saved it under a new name called PivotsNTPlus. I then added:
    in the Variables Section: private double rmid = 0;
    in the Initialize: Add(new Plot (Color.Black, "RMID"));
    in OnBarUpdate: rmid = 0.5*(pp + r1);
    and RMID.Set(rmid);
    and further down in Properties region:
    [Browsable(false)]
    [XmlIgnore]
    public DataSeries RMID
    {
    get { return Values[7]; }
    }

    sandman

    Comment


      #3
      Hello sandman,

      Thanks for your post(s).

      When you applied the indicator, do you see any error messages posted in the "Log" tab of the control center related to the indicator?
      Paul H.NinjaTrader Customer Service

      Comment


        #4
        Yes, Paul. It says: Error on plotting indicator: Please check the OnBarUpate or the Plot method: Index was outside the bounds of the array.

        Comment


          #5
          Hello sandman,

          Thanks for your reply.

          This would indicate that an index is pointing to something that does not exist. As you have added a plot you would need to make sure that you have added enough for the various arrays. Your 2nd post looks correct to me in terms of what is needed to add another plot so that is not the issue.

          In looking at the indicator code, I think the issue is likely to be the first variable listed as it is an array of brushes and I only count 7. I would add another to that array statement and see if that resolves the issue. Note that this is just a place holder as the actual color is determined by your add plot statement.
          Paul H.NinjaTrader Customer Service

          Comment


            #6
            Paul. I vaguely get what you are saying but have a difficulty transferring it into code (I am not really a programmer). I counted 6 arrays total in the original version. And I added 1 for the new mid-pivot makes 7 total, yet you saying you count "only" 7 seems to indicate it now needs 8. ???

            Could you look over the full code which I have attached as a cs file and indicate where I have to add what?

            sandman
            Attached Files

            Comment


              #7
              Hello Sandman,

              Thanks for your reply.

              This is the first line in region variables:

              private SolidBrush[] brushes = { new SolidBrush(Color.Black), repeats 6x times...

              There are a total 7 of new SolidBrush(Color.Black) you need to make a copy and add 1 so that in the array there are 8 of new SolidBrush(Color.Black)

              Of course if you add more pivots you will need to add another one for each pivot added.
              Paul H.NinjaTrader Customer Service

              Comment


                #8
                Paul. Thank you very much. Needless to say that worked immediately.

                sandman

                Comment


                  #9
                  Paul.
                  I am finished with it. I call it PivotsRoundedtoTickSizePlus. Firstly, rounding to tick size is useful for instruments such as 6J. "Plus" because I added pivots in between PP and S1, S1 and S2 and S2 and S3 (same for Resistance). I also added in the Woodie S1 and R1. These additional pivots can be turned on or off with "Addtl pivots" in the Parameters section of the indicator menu.

                  Before posting it in the files sharing section I thought I would check to see if you would test it to see there is nothing untoward that crept in. And secondly I'd like to make sure I am not violating something as NinjaTrader actually holds the copyright on the indicator. I included a note in that respect in the beginning of the code.

                  sandman
                  Attached Files

                  Comment


                    #10
                    Hello sandman,

                    Thanks for your reply.

                    Please feel free to post in the NinjaTrader7 Indicators file sharing are. We appreciate your consideration and welcome your contributions to the community.
                    Paul H.NinjaTrader Customer Service

                    Comment


                      #11
                      Paul. Thanks. I posted it now (though I took the Woodie Pivots out again). Thanks again for your help.
                      sandman

                      Comment

                      Latest Posts

                      Collapse

                      Topics Statistics Last Post
                      Started by Christopher_R, Today, 12:29 AM
                      0 responses
                      7 views
                      0 likes
                      Last Post Christopher_R  
                      Started by sidlercom80, 10-28-2023, 08:49 AM
                      166 responses
                      2,235 views
                      0 likes
                      Last Post sidlercom80  
                      Started by thread, Yesterday, 11:58 PM
                      0 responses
                      3 views
                      0 likes
                      Last Post thread
                      by thread
                       
                      Started by jclose, Yesterday, 09:37 PM
                      0 responses
                      7 views
                      0 likes
                      Last Post jclose
                      by jclose
                       
                      Started by WeyldFalcon, 08-07-2020, 06:13 AM
                      10 responses
                      1,415 views
                      0 likes
                      Last Post Traderontheroad  
                      Working...
                      X