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

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:	425
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:



            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 trilliantrader, Today, 08:16 AM
                      2 responses
                      6 views
                      0 likes
                      Last Post trilliantrader  
                      Started by samish18, Today, 08:31 AM
                      1 response
                      1 view
                      0 likes
                      Last Post NinjaTrader_Clayton  
                      Started by Creamers, 09-08-2023, 10:26 AM
                      6 responses
                      157 views
                      0 likes
                      Last Post JonyGurt  
                      Started by funk10101, Today, 08:14 AM
                      1 response
                      2 views
                      0 likes
                      Last Post NinjaTrader_Jesse  
                      Started by bill2023, Yesterday, 08:51 AM
                      3 responses
                      22 views
                      0 likes
                      Last Post bltdavid  
                      Working...
                      X