Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

How to get previous Swing high/low values?

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

    How to get previous Swing high/low values?

    Hi - I trying to develop a strategy that needs to read the previous 2-3 swing high/low values in Swing indicator. It seems like the indicator itself doesn't memorize previous values. Would you please provide any adivce on how this can be done?

    Thank you!

    #2
    Hello HiddenPhilosopher,

    Thanks for your post.

    Here is a link to the help guide on the swing indicator: https://ninjatrader.com/support/help...nt8/?swing.htm

    The help guide shows that the swing indicator provide the means to access previous swing points. For example from the help guide you see:
    Swing(int strength).SwingHighBar(int barsAgo, int instance, int lookBackPeriod) Where you specify the lookback period (bars) and then the instance to look for where 1 is the latest, 2 if the prior and 3 would be before that. The method then returns the bars ago that the instance occurred and with that you can access the High or Low of those data points.

    If you are working in the Strategy Builder, the swing indicator only provides the Swing High or Swing low, You can detect a change in the swing points by checking the previous bar of the swing high to the current bar of the swing high and when they are Not equal a new swing high has been found. This would provide you with the current swing and the previous swing high values. (same for the swing Low).

    Paul H.NinjaTrader Customer Service

    Comment


      #3
      Originally posted by NinjaTrader_PaulH View Post
      Hello HiddenPhilosopher,

      Thanks for your post.

      Here is a link to the help guide on the swing indicator: https://ninjatrader.com/support/help...nt8/?swing.htm

      The help guide shows that the swing indicator provide the means to access previous swing points. For example from the help guide you see:
      Swing(int strength).SwingHighBar(int barsAgo, int instance, int lookBackPeriod) Where you specify the lookback period (bars) and then the instance to look for where 1 is the latest, 2 if the prior and 3 would be before that. The method then returns the bars ago that the instance occurred and with that you can access the High or Low of those data points.

      If you are working in the Strategy Builder, the swing indicator only provides the Swing High or Swing low, You can detect a change in the swing points by checking the previous bar of the swing high to the current bar of the swing high and when they are Not equal a new swing high has been found. This would provide you with the current swing and the previous swing high values. (same for the swing Low).

      That's not what I'm looking for. I'm using it in coding my strategy. This sounds like, if I set a lookback period, it re-calculates the high/low points based on the number of bars I set to look back. (e.x. 5 bars lookback and 15 bars lookback can have very different results) What I'm looking for is the previous high/low values recorded on the chart, which are fixed.

      Comment


        #4
        Hello HiddenPhilosopher,

        Thanks for your reply.

        The look back does not recalculate the swing, it will report the bar where the swing point is of the instance you are looking for. Once you have the bars ago where the swing point occurs you can pull the High and Low from the price series using the bars ago reference.

        I've created a short video to demonstrate just using the swing high side: https://paul-ninjatrader.tinytake.co...M18xMzU5MjA1NA


        Paul H.NinjaTrader Customer Service

        Comment


          #5
          Originally posted by NinjaTrader_PaulH View Post
          Hello HiddenPhilosopher,

          Thanks for your reply.

          The look back does not recalculate the swing, it will report the bar where the swing point is of the instance you are looking for. Once you have the bars ago where the swing point occurs you can pull the High and Low from the price series using the bars ago reference.

          I've created a short video to demonstrate just using the swing high side: https://paul-ninjatrader.tinytake.co...M18xMzU5MjA1NA

          Thank you so much for the video! This is very clear!

          Comment


            #6
            Hi Paul,

            My SwingHighs are working. But my SwingLows aren't. Why?

            In the attached screenshot, why does it consider 15 bars ago to be the 3:16 PM Bar most recent Swing Low (there's no Swing Low yellow dots 15 bars ago) — why not the previous Swing Low (with yellow dots at 2:28 PM)?

            How to make it consider the previous (yellow dotted) Swing Low instead?
            Click image for larger version  Name:	why.png Views:	0 Size:	862.1 KB ID:	1159618

            And why does the Print in the 2nd for loop block (SwingLowBar) doesn't appear in the output while the Print in the 1st for loop block (SwingHighBar) does?

            EDIT:
            To better see:
            https://i.imgur.com/u2jj5Rb.png

            Thanks a lot for your insights!

            EDIT2:
            I found out how to get the previous SwingLow:
            I needed to increase the Lookback number to 50.
            It was also the solution to the the missing SwingLow Prints.
            A screenshot:
            Last edited by Cormick; 06-11-2021, 05:30 AM. Reason: Solution: Increase the Lookback parameter

            Comment


              #7
              Hello Cormick,

              Thanks for your post.

              Sounds like you resolved your question, well done.

              Paul H.NinjaTrader Customer Service

              Comment

              Latest Posts

              Collapse

              Topics Statistics Last Post
              Started by junkone, Yesterday, 08:06 PM
              3 responses
              16 views
              0 likes
              Last Post NinjaTrader_EricB  
              Started by fscabrera03, Yesterday, 07:27 PM
              1 response
              5 views
              0 likes
              Last Post tradecombine  
              Started by Rad4633, Yesterday, 05:31 PM
              0 responses
              2 views
              0 likes
              Last Post Rad4633
              by Rad4633
               
              Started by litamm89, Yesterday, 03:51 PM
              0 responses
              6 views
              0 likes
              Last Post litamm89  
              Started by sgordet, Yesterday, 01:52 PM
              3 responses
              12 views
              0 likes
              Last Post NinjaTrader_Tyler  
              Working...
              X