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

Pivot indicator

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

    Pivot indicator

    I'm creating my own pivots indicator and use the following line to draw the daily pivot value in OnBarUpdate()

    DrawLine("PP",true,startline,pp,0,pp,Color.Red,DashStyle.Dash,1);

    where startline = first bar of the session

    pp = daily pivot value

    The line seems to be extending back further than the current session, how can I fix this so that the line starts from the current session only?

    #2
    You will need to print out what your startline parameter is and debug it to get it to the correct value to reach the first bar of the session.
    Josh P.NinjaTrader Customer Service

    Comment


      #3
      drawline error

      The error was the parameter startline stored the currentbar value at the starpoint (session break) but in terms of bars ago from current bar 0 this is currentbar - startline.

      DrawLine("PP",true,CurrentBar-startline,pp,0,pp,Color.Red,DashStyle.Dash,1);

      Comment


        #4
        Not sure what you mean. What error are you receiving?
        Josh P.NinjaTrader Customer Service

        Comment


          #5
          line error

          Sorry I mean the error is now fixed as I was using the wrong start point value for the line so the above code [currentbar-startline] is the fixed version.

          I have attached an image showing the indicator displaying daily pivot values for the current session. How do I alter the display so that all the price bars are shown but the pivots far from the price do not need to be displayed so the price action is not 'squashed' as shown in the image?
          Attached Files

          Comment


            #6
            Please try setting AutoScale (second DrawLine input) to false.
            BertrandNinjaTrader Customer Service

            Comment


              #7
              fix

              Yes that worked. Thank you.

              Comment

              Latest Posts

              Collapse

              Topics Statistics Last Post
              Started by moneyexe, Today, 11:22 AM
              0 responses
              2 views
              0 likes
              Last Post moneyexe  
              Started by stevec1824, Today, 11:00 AM
              1 response
              2 views
              0 likes
              Last Post NinjaTrader_ChristopherJ  
              Started by sofortune, Today, 10:05 AM
              2 responses
              6 views
              0 likes
              Last Post sofortune  
              Started by sofortune, 05-10-2024, 10:28 AM
              6 responses
              46 views
              0 likes
              Last Post sofortune  
              Started by ETFVoyageur, Today, 08:54 AM
              3 responses
              31 views
              0 likes
              Last Post ETFVoyageur  
              Working...
              X