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

Zig Zag indicator calculation

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

    Zig Zag indicator calculation

    Hi,

    I'm trying to use the zig zag indicator in my trading strategy but I do not understand how it is calculated in the ninjatrader. Can you help me to explain how its calculated based on the setting I use below?

    Deviation type: Points
    Deviation value: 0.5

    #2
    Hello neshnix89,

    Thank you for your post.

    From the help guide on ZigZag indicator: Description - The ZigZag indicator highlights trends based on user defined threshold values and helps filtering the noise in price charts, it's not a classical indicator but more a reactive filter showing extreme price points. In processing it's calculations it can update it's current direction and price extreme point based on newly incoming data, the current developing leg should be thought of temporary until a new leg in opposite direction has been set.

    If you are using the ZigZag indicator with a deviation value of 0.5 Points, the ZigZag indicator would look for high or low points based on a 0.5 Point deviation.

    ZigZag Indicator - https://ninjatrader.com/support/help...nt8/zigzag.htm

    More information may be found in this forum post - https://ninjatrader.com/support/foru...-zag-indicator

    Let us know if we may assist further.
    Brandon H.NinjaTrader Customer Service

    Comment


      #3
      How ZigZag can be used in the Strategy Builder? e.g. falling slope, rising slope?

      Comment


        #4
        Hello Radano,

        Thanks for your note.

        You could use the ZigZag indicator high or low plots to create conditions or actions using the Strategy Builder. For example, you could make indicator to value comparisons using the ZigZag indicator high or low plot. The ZigZag indicator is located in the Indicators folder when creating a condition or action in the Strategy Builder.

        See the help guide documentation below for creating indicator to value comparisons and other conditions and actions.
        Indicator to value comparison - https://ninjatrader.com/support/help...lueComparisons
        Using indicator inputs in other indicators - https://ninjatrader.com/support/help...therIndicators
        Condition Builder - https://ninjatrader.com/support/help...on_builder.htm
        Actions - https://ninjatrader.com/support/help...t8/actions.htm

        Let us know if we may assist further.
        Brandon H.NinjaTrader Customer Service

        Comment


          #5
          I tried to use ZZ with slope rising and falling for longs and shorts respectively. It does not work for me. Is there any other way to implement this condition ?

          Comment


            #6
            Hello Radano,

            Thank you for your note.

            Please clarify the following, 'It does not work for me'. Please provide a brief description of what exactly does not work?

            I suggest printing out the ZigZag indicator plots in your script to see the value of the ZigZag plots when the script is running. This will allow you to determine what the value of the ZigZag indicator is and how your strategy is behaving.

            Below is a link to a forum post that demonstrates using prints to understand behavior and including a link to a video recorded using the Strategy Builder.
            https://ninjatrader.com/support/foru...121#post791121

            Let us know if we may assist further.
            Brandon H.NinjaTrader Customer Service

            Comment


              #7
              Simply I tried Misc(Slope) Series1(ZigZag, HighPoint) Equals Misc(Falling), also I tried Misc(Falling) Series1(ZigZag, HighPoint) Equals Misc(True) and it does not seem that's correct. It should be used as a comparison ZigZagHigh >ZigZagLow, right?
              Last edited by Radano; 06-08-2021, 03:40 PM.

              Comment


                #8
                Hello Radano,

                Thank you for the clarification.

                It would not be possible to accomplish this in the Strategy Builder. To accomplish this, you would need to unlock your code from the Strategy Builder using the 'Unlock code' button. After unlocking the code you would use ZigZag().HighBar() and ZigZag().LowBar() which is not available in the Strategy Builder. This provides the bars ago value for the last set high/low (or n instances ago). Then, you could compare the current Close[0] to be less than the ZigZag().HighBar()/ZigZag().LowBar().

                See this help guide documentation for more information about using the ZigZag indicator: https://ninjatrader.com/support/help...t8/?zigzag.htm

                Also, you may find information in this forum post to be helpful: https://ninjatrader.com/support/foru...go#post1059682

                Let us know if we may assist further.
                Brandon H.NinjaTrader Customer Service

                Comment


                  #9
                  NinjaTrader_BrandonH - The ZigZag indicator's link you shared above isnt working. Do you have a sample code on how to call for the Bar sequence of the candles that i have highlighted in attached screenshot using ZigZag indicator in a Strategy?

                  If not the Bar sequence, how can i directly call the Highs & Lows of those bars to compare with current Bar?

                  Click image for larger version

Name:	image.png
Views:	432
Size:	20.0 KB
ID:	1255313

                  Comment


                    #10
                    Hi Percy, I attached an example that utilizes the ZigZag indicator. It reads the ZigZag data and draws a dot on the Highs and lows.
                    Attached Files
                    Chris L.NinjaTrader Customer Service

                    Comment

                    Latest Posts

                    Collapse

                    Topics Statistics Last Post
                    Started by Jimmyk, 01-26-2018, 05:19 AM
                    6 responses
                    835 views
                    0 likes
                    Last Post emuns
                    by emuns
                     
                    Started by jxs_xrj, 01-12-2020, 09:49 AM
                    6 responses
                    3,291 views
                    1 like
                    Last Post jgualdronc  
                    Started by Touch-Ups, Today, 10:36 AM
                    0 responses
                    10 views
                    0 likes
                    Last Post Touch-Ups  
                    Started by geddyisodin, 04-25-2024, 05:20 AM
                    11 responses
                    62 views
                    0 likes
                    Last Post halgo_boulder  
                    Started by Option Whisperer, Today, 09:55 AM
                    0 responses
                    9 views
                    0 likes
                    Last Post Option Whisperer  
                    Working...
                    X