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

Line at Pivot Highs

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

    Line at Pivot Highs

    Hello,

    Im trying to figure out the best way to draw a Ray/Line at a pivotal high. With HighestBar(), you would just get a value update every x bars its set to, so that wouldnt work. I didnt see anything else in the reference library related to highest bar.

    Thanks,
    Chris

    Click image for larger version

Name:	image.png
Views:	96
Size:	1.5 KB
ID:	1243846

    #2
    Hello ChrisR,

    If you are trying to find the highest price for a period of time HighestBar would be able to do that. I am not certain I understand what you said about that not working, it would only update the highest bar if a new highest bar was formed, it otherwise keeps reporting the same value as long as the previous high remains unbroken.
    The help guide sample shows getting the highest bar and price for the current trading session.

    If you otherwise are trying to do something like the pivots indicator you can take a look at the logic it uses to draw the pivots at different levels.
    JesseNinjaTrader Customer Service

    Comment


      #3
      Originally posted by NinjaTrader_Jesse View Post
      Hello ChrisR,

      If you are trying to find the highest price for a period of time HighestBar would be able to do that. I am not certain I understand what you said about that not working, it would only update the highest bar if a new highest bar was formed, it otherwise keeps reporting the same value as long as the previous high remains unbroken.
      The help guide sample shows getting the highest bar and price for the current trading session.

      If you otherwise are trying to do something like the pivots indicator you can take a look at the logic it uses to draw the pivots at different levels.
      My understanding of HighestBar is that it returns the highest bar for the lookback period. As time progress, the lookback period moves foward in time, thus a new highest bar would be returned. In the picture above with a period of say 5, a new highest bar would than be returned in that dip below. Is this not accurate? I want to be able to draw a line at pivotal high, not every new high reported in a defined forward moving lookback period.

      Comment


        #4
        Ideally I would want to do something like this, while ignoring everything in the blue circle as those are not pivotal highs. With a HighestBar at 5, it would return a high bar in that blue circle when they are not pivotal highs.​

        Click image for larger version

Name:	image.png
Views:	68
Size:	8.7 KB
ID:	1244038

        Comment


          #5
          Why not just use the Swing indicator?

          Comment


            #6
            Hello ChrisR,

            The lookback period would only progress forward if you specify a fixed amount, the sample in the help guide uses the property BarsSinceNewTradingDay so it would always be the full session up to the current bar.

            To do something other than finding the highest bar from the start of the session you would need to use logic. What you pictured is similar to the pivots indicator. If you wanted to make multiple levels of pivotal highs that would be a good place to start by either using the pivots indicator or modifying it for your own uses.
            JesseNinjaTrader Customer Service

            Comment

            Latest Posts

            Collapse

            Topics Statistics Last Post
            Started by Waxavi, Today, 02:10 AM
            1 response
            17 views
            0 likes
            Last Post NinjaTrader_LuisH  
            Started by Kaledus, Today, 01:29 PM
            5 responses
            13 views
            0 likes
            Last Post NinjaTrader_Jesse  
            Started by Waxavi, Today, 02:00 AM
            1 response
            12 views
            0 likes
            Last Post NinjaTrader_LuisH  
            Started by alifarahani, Today, 09:40 AM
            6 responses
            23 views
            0 likes
            Last Post alifarahani  
            Started by gentlebenthebear, Today, 01:30 AM
            3 responses
            17 views
            0 likes
            Last Post NinjaTrader_Jesse  
            Working...
            X