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

Swing high and low

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

    Swing high and low

    Using the strategy builder I'm trying to mark swing high and swing lows. So I am able to say if the high is greater than the high for the previous 10 bars using the (bars ago) line. But how do I say if the high is greater than the high 10 bars in front of it? It won't use negative numbers to reference bars in front of it. I have created a similar indicator in TOS and it looks like the attached image. You can see how it draws lines at the highs and lows.
    Attached Files

    #2
    Hello Shiner452,

    Thanks for your post.

    If your intent is to create an indication of where the swing is you can use the swing indicator itself on the chart. If you do not like the use of the dots that Swing employs, you can easily change the display from Dots to a line by changing the plots "Plotstyle" in the indicator panel. I've attached a screenshot of what swing indicator looks like when these are set to a line plotstyle instead of the default dots:

    Click image for larger version

Name:	Shiner452-1.PNG
Views:	316
Size:	39.9 KB
ID:	1172193


    Paul H.NinjaTrader Customer Service

    Comment


      #3
      So I have done that but I feel i need to make my own because when I try and reference the swinglow or swing high in the swing indicator that comes with NinjaTrader it only uses a recent low and not the actual swing low line.

      Comment


        #4
        Here see this annotation. It only takes trades during RTH which is why I’d didn’t go long on the swing high but it has no reason to go long where it did.
        Attached Files

        Comment


          #5
          Hello Shiner452,

          Thanks for your post.

          You are welcome to create anything that you wish but I will tell you that the Strategy builder will be a limitation in trying to reconstruct the swing indicator if that is your thinking.

          I would suggest instead spending some time with the swing indicator to best understand how it works and testing various "strength" settings to have the indicator perform as you wish.

          The swing indicator is a lagging indicator meaning that it does not confirm a swing until the "strength number of bars have passed provided that price has not exceeded that potential swing. Once the indicator has confirmed the swing, then at that point the dots are drawn back the strength number of bars to identify the swing point, and then on subsequent bars, the dots will continue to be drawn until price exceeds the current swing high indicating that a new potential swing high is occurring.

          From a strategy builder perspective, what I would suggest is to create a double variable to hold the swing high and another to hold the swing low. Then create a set where the condition is (using strength setting of 5 (which is the default) Swing(5).SwingHigh[0] >Swing(5).SwingHigh[6] and the action would be to save the value of Swing(5).SwingHigh[6] into the double variable. The same but opposite in another set for the swing low. Then for trading check that the High data series crosses above the double variable, same but opposite for low.
          Paul H.NinjaTrader Customer Service

          Comment

          Latest Posts

          Collapse

          Topics Statistics Last Post
          Started by AaronKoRn, Yesterday, 09:49 PM
          0 responses
          11 views
          0 likes
          Last Post AaronKoRn  
          Started by carnitron, Yesterday, 08:42 PM
          0 responses
          10 views
          0 likes
          Last Post carnitron  
          Started by strategist007, Yesterday, 07:51 PM
          0 responses
          12 views
          0 likes
          Last Post strategist007  
          Started by StockTrader88, 03-06-2021, 08:58 AM
          44 responses
          3,981 views
          3 likes
          Last Post jhudas88  
          Started by rbeckmann05, Yesterday, 06:48 PM
          0 responses
          9 views
          0 likes
          Last Post rbeckmann05  
          Working...
          X