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

How to identify swing high & swing lows with true/false condition

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

    How to identify swing high & swing lows with true/false condition

    Hi,

    Is there a way to identify a swing high or swing low in the Strategy Builder? I'm aware of the 'swing' indicator however it does not return a true or false condition.

    I'm trying to use a swing high or swing low as the start of a bar-by-bar check of my strategy conditions but I don't know how to identify the swing high or swing low to start the bar-by-bar check.

    Thanks,

    Neil

    #2
    Hello Neil,

    Thanks for your post.

    Yes, you can use the swing Indicator in the Strategy Builder but it is a "Lagging" indicator that cannot produce a signal until the "Strength" setting number of bars have passed the swing point. So the indicator/strategy would not know a swing point had occurred until a few bars after the fact.

    I've attached an example strategy to show how you can confirm when the swing has been confirmed(changed). It uses a strength setting of 5. It will draw Bluish background when the swing High is confirmed and a tomato color when the swing low has been confirmed. In addition if you open a New>Ninjascript output window, it will print the bar by bar value of both swing high and swing low so you can see better what is going on value wise and can track back to the colored background areas.


    Click image for larger version

Name:	burtoinlondon1.PNG
Views:	539
Size:	105.6 KB
ID:	1175476

    [ATTACH]n1175477[/ATTACH]


    Paul H.NinjaTrader Customer Service

    Comment


      #3
      Thanks NinjaTrader_PaulH .

      So assuming that I have a strategy which will calculate on the close of the current bar and I can confirm the previous swing high / lows are (as per your example test or similar) is there a way for the strategy to know how many bars ago from the current bar the swing high / low occurred?

      Neil

      Comment


        #4
        Hello Neil,

        Thanks for your reply.

        With reference to the example strategy, when the strategy has detected a new swing, it would be the strength number of bars ago +1 at that point.
        Paul H.NinjaTrader Customer Service

        Comment


          #5
          Are you trying to know when you have are retesting or crossing a the most recent Swing High?

          Comment


            #6
            DTSSTS - I'm trying to work out how many bars ago the last swing high or swing low took place.

            Comment


              #7
              i assume you know how to count the bars (I do not) and you can create some rule that changes to True when a new swing high is plotted, and then start the count

              IF SO, then have you tried to state that SwingHigh[0] now 0 bars ago is not equal to SwingHigh[1]

              that would be a knew swing high to start your count

              Comment


                #8
                I managed to figure it out last night...one step forward in automating my strategy!

                Comment

                Latest Posts

                Collapse

                Topics Statistics Last Post
                Started by Haiasi, 04-25-2024, 06:53 PM
                2 responses
                17 views
                0 likes
                Last Post Massinisa  
                Started by Creamers, Today, 05:32 AM
                0 responses
                5 views
                0 likes
                Last Post Creamers  
                Started by Segwin, 05-07-2018, 02:15 PM
                12 responses
                1,786 views
                0 likes
                Last Post Leafcutter  
                Started by poplagelu, Today, 05:00 AM
                0 responses
                3 views
                0 likes
                Last Post poplagelu  
                Started by fx.practic, 10-15-2013, 12:53 AM
                5 responses
                5,408 views
                0 likes
                Last Post Bidder
                by Bidder
                 
                Working...
                X