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:	61
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.
    Chris L.NinjaTrader Customer Service

    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.
        Chris L.NinjaTrader Customer Service

        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:

            https://ninjatrader.com/support/help...tAsSourceFiles

            I look forward to assisting.
            Chris L.NinjaTrader Customer Service

            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.

                Chris L.NinjaTrader Customer Service

                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.



                    Chris L.NinjaTrader Customer Service

                    Comment


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

                      Comment

                      Latest Posts

                      Collapse

                      Topics Statistics Last Post
                      Started by Byndhwkfrs, Today, 02:29 AM
                      0 responses
                      3 views
                      0 likes
                      Last Post Byndhwkfrs  
                      Started by slenderketodiet, Today, 01:57 AM
                      0 responses
                      3 views
                      0 likes
                      Last Post slenderketodiet  
                      Started by slenderketodiet, Today, 01:56 AM
                      0 responses
                      1 view
                      0 likes
                      Last Post slenderketodiet  
                      Started by MarilySchwab, Today, 01:32 AM
                      0 responses
                      1 view
                      0 likes
                      Last Post MarilySchwab  
                      Started by roseiany, Today, 01:29 AM
                      0 responses
                      1 view
                      0 likes
                      Last Post roseiany  
                      Working...
                      X