• If this is your first visit, you will have to register before you can post. To view messages, please scroll below and select the forum that you would like to visits. Questions? Be sure to check out the Forum FAQ.

Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

NT7 Pivots indicator

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

    NT7 Pivots indicator

    The width of the NT7 pivot lines can be set in the indicator menu. Its measured in bars ago, i.e. to the left.

    Question: Where in the code can I change the width in the other direction i.e. to the right. It seems it's hard coded to "1" i.e. 1 bar ago. I'd like to set this to 3, 4 or 5 bars ago.

    sandman


    #2
    Hello sandman,

    Thank you for the post.

    For this indicator, it uses the Plot override to render the lines you see and this uses the LastBarIndexPainted as part of the rendering calculation. You would need to modify the plot logic to account for a different ending point. This is not necessarily something I could detail the full specifics on but bit I can provide a small sample to get you started.

    I did a quick test to make sure you can render into the future and it looks like it is possible. I have attached an image of the changes required to see this outcome. Mainly it is just adding + 10 to the LastBarIndexPainted where it is used and also removing the condition to check if the bar has a valid series index. The final part which I have not demonstrated in the image is toggling the price being picked.

    The original code is:
    Code:
    double    val = series.Get(idx);
    which is getting a price for the bar index. This does not work once your past the LastBarIndexPainted so you would need to make a condition to change between using the index and what is displayed in the image or:

    Code:
    double  val = series.Get(this.LastBarIndexPainted);
    For simplicity, I did not create this condition and just used LastBarIndexPainted for the price. To make the indicator correctly, you could add a condition which toggles the price based on the current idx and LastBarIndexPainted value.

    I look forward to being of further assistance.
    JesseNinjaTrader Customer Service

    Comment


      #3
      Jesse, thanks for your fast reply. However, I think your response uses NT8's code which doesn't help me as I am using NT7. Could you advise the same as you did but for NT7 please. (I also had a slight mistake in my request as I want to make the lines shorter, i.e. not extend them into the future, but shorten them into the past so to speak. But that would probably easily resolve by using MINUS10 instead of PLUS10 in your example). I would just need your same advice but for NT7.

      sandman

      Comment


        #4
        Hello sandman,

        The reply I provided is for NT7 as we are in the NT7 forums. The image is also an image of the NT7 NS editor and chart, you can compare this with code with the code you see in the platform to confirm this is for NT7.

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

        Comment


          #5
          Shucks - my mistake. I guess I simply did not look far enough down in the code. What you provided is sufficient for me to work with.

          Thank you, Jesse.

          Comment


            #6
            Jesse. Thanks for your help. It provided exactly what I was looking for. Please allow me one more question on the same subject of the Pivots indicator. Where in the code can I change the font size of the pivot labels (PP, R1, R2, S1, S2 etc). I'd like to make them a bit smaller. I looked but could not figure it out.
            sandman

            Comment


              #7
              Hello sandman,

              This indicator currently uses the ChartControl to get the charts font, you can change this by making the following modification:

              from

              Code:
              graphics.DrawString(plot.Name, ChartControl.Font, brush, lastX, lastY - textHeight / 2, stringFormatFar);
              to

              Code:
              graphics.DrawString(plot.Name, new Font("Arial", 5), brush, lastX, lastY - textHeight / 2, stringFormatFar);
              I look forward to being of further assistance.
              JesseNinjaTrader Customer Service

              Comment


                #8
                Thank you very much.

                Comment

                Latest Posts

                Collapse

                Topics Statistics Last Post
                Started by DavidHP, Today, 04:11 PM
                0 responses
                1 view
                0 likes
                Last Post DavidHP
                by DavidHP
                 
                Started by alexstox, 03-24-2019, 01:07 PM
                6 responses
                51 views
                0 likes
                Last Post NinjaTrader_PatrickG  
                Started by fredfred, Today, 11:29 AM
                3 responses
                11 views
                0 likes
                Last Post NinjaTrader_JoshG  
                Started by swcooke, Today, 10:38 AM
                3 responses
                11 views
                0 likes
                Last Post NinjaTrader_Jesse  
                Started by rickyblah12, Today, 10:12 AM
                5 responses
                20 views
                0 likes
                Last Post NinjaTrader_ChrisL  
                Working...
                X