Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

ZigZag Values

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

    ZigZag Values

    Hi, how can I know the value of the low and high from the last zig zag plot?? I'm receiving wrong values if I print their values.

    Print("HIGH: "+ZigZag1.ZigZagHigh[0]);
    Print(" LOW: "+ZigZag1.ZigZagLow[0]);

    Click image for larger version

Name:	zigzag.png
Views:	595
Size:	21.8 KB
ID:	1138136

    Thank you in advance

    #2
    Hello J0shTrader, thanks for writing in.

    Can we confirm the settings for the chart ZigZag VS the ZigZag created through code? The chart default settings for ZigZag are Deviation Type: Points, Deviation Value: 0.5, Use high low = false. Make sure this is set up the same way in your script.

    I look forward to hearing from you.

    Comment


      #3
      Originally posted by NinjaTrader_ChrisL View Post
      Hello J0shTrader, thanks for writing in.

      Can we confirm the settings for the chart ZigZag VS the ZigZag created through code? The chart default settings for ZigZag are Deviation Type: Points, Deviation Value: 0.5, Use high low = false. Make sure this is set up the same way in your script.

      I look forward to hearing from you.

      Hi Chris,

      Thanks for your reply. if I understood, I can't use Deviation of 15 and get the 2 last points of the plot? is that right?

      Thank you

      Comment


        #4
        Hello J0shTrader, thanks for your reply.

        You can set the ZigZag parameters on the chart to whatever you would like, it just needs to match in the ZigZag() constructor e.g.

        ZigZag(DeviationType.Points, 15, false)

        Please let me know if I can assist any further.

        Comment


          #5
          Originally posted by NinjaTrader_ChrisL View Post
          Hello J0shTrader, thanks for your reply.

          You can set the ZigZag parameters on the chart to whatever you would like, it just needs to match in the ZigZag() constructor e.g.

          ZigZag(DeviationType.Points, 15, false)

          Please let me know if I can assist any further.
          Hi Chris,

          Yes of course it matches, I set up the indicator in the constructor with for example deviation = 15 (the picture above) but in my code, I don't know how to access properly to the last 2 points of the zigzag plot. I would like to know the last high and the last low which I assume is the last line plotted in the chart.

          Thank you.

          Comment


            #6
            Hello J0shTrader, thanks for your reply.

            The last two data points of the indicator can be accessed through the ZigZagHigh[0] and ZigZagLow[0] as you have in your first post. If you have a test script that I can run on my machine I will be happy to test it out. See here for instructions on exporting:



            I look forward to assisting.

            Comment


              #7
              Hi again,

              I have a new question about ZigZag values, How can I know the order of Highs and Lows? I mean, I need to know if ZigZagHigh[0] appears before ZigZagLow[0] to determine the price is going down, How can I achieve that?

              Thank you

              Comment


                #8
                Hello J0shTrader, thanks for your reply.

                The best way of keeping track of this would be to use the LowBar and HighBar methods that are provided which tell you how many bars ago the low or high happened. If LowBar returns a lower value than HighBar then the last zig zag was a low, and vice versa.

                Please let me know if I can assist any further.

                Comment


                  #9
                  Originally posted by NinjaTrader_ChrisL View Post
                  Hello J0shTrader, thanks for your reply.

                  The best way of keeping track of this would be to use the LowBar and HighBar methods that are provided which tell you how many bars ago the low or high happened. If LowBar returns a lower value than HighBar then the last zig zag was a low, and vice versa.

                  Please let me know if I can assist any further.
                  Thanks for your reply Chris, but I'm not sure about the parameters, for example, this setup for the ZigZag:

                  ZBig = ZigZag(Close, DeviationType.Points, 31, true);

                  Is this LowBar valid?? -> LastLow = ZBig.LowBar(31,1,31);

                  Thank you so much

                  Comment


                    #10
                    Hello J0shTrader, thanks for your reply.

                    If you want to get the latest ZigZag your BarsAgo parameter should be 0, 1, 31 to start from the right most side of the chart, then look back 31 bars for the last ZigZag. What you posted will start 31 bars back and look 31 bars behind that starting point.

                    The parameters for LowBar and HighBar are: (int barsAgo, int instance, int lookBackPeriod)

                    Please let me know if I can assist any further.



                    Comment


                      #11
                      Thank you Chris, sometimes I'm totally lost with these functions.

                      Comment

                      Latest Posts

                      Collapse

                      Topics Statistics Last Post
                      Started by Geovanny Suaza, 02-11-2026, 06:32 PM
                      0 responses
                      571 views
                      0 likes
                      Last Post Geovanny Suaza  
                      Started by Geovanny Suaza, 02-11-2026, 05:51 PM
                      0 responses
                      330 views
                      1 like
                      Last Post Geovanny Suaza  
                      Started by Mindset, 02-09-2026, 11:44 AM
                      0 responses
                      101 views
                      0 likes
                      Last Post Mindset
                      by Mindset
                       
                      Started by Geovanny Suaza, 02-02-2026, 12:30 PM
                      0 responses
                      548 views
                      1 like
                      Last Post Geovanny Suaza  
                      Started by RFrosty, 01-28-2026, 06:49 PM
                      0 responses
                      549 views
                      1 like
                      Last Post RFrosty
                      by RFrosty
                       
                      Working...
                      X