Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Zigzag values

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

    Zigzag values

    I am having issue with printing lowbar. I believe the syntax is not right.
    Print("The high of the zigzag bar is " + High[Math.Max(0, ZigZag(DeviationType.Points, 0.5, false).HighBar(0, 1, 100))]);
    Print("The low of the zigzag bar is " + Low[Math.Min(0, ZigZag(DeviationType.Points, 0.5, false).LowBar(0, 1, 100))]);



    #2
    Hello tkaboris,

    Print("The low of the zigzag bar is " + Low[Math.Max(0, ZigZag(DeviationType.Points, 0.5, false).LowBar(0, 1, 100))]);

    The Math.Max(0, barsAgoValue) is to ensure that the index returned is not negative, which would be an invalid index.​
    Chelsea B.NinjaTrader Customer Service

    Comment


      #3
      thank you
      how do i find high bar length in price level, not in number of points?
      In my condition i want to specify that Close[0] > Hbarlength ​(price level)
      I attached a screenshot to find what i am looking for.

      double HBar = High[Math.Max(0, ZigZag(DeviationType.Points, 0.5, false).HighBar(0, 1, 100))];
      double HBarPrev = High[Math.Max(0, ZigZag(DeviationType.Points, 0.5, false).HighBar(0, 2, 100))];
      double LBar = Low[Math.Max(0, ZigZag(DeviationType.Points, 0.5, false).LowBar(0, 1, 100))];
      double LBarPrev = Low[Math.Max(0, ZigZag(DeviationType.Points, 0.5, false).LowBar(0, 2, 100))];
      double Hbarlength = Math.Abs(HBar - LBar) / 2;

      ​​Click image for larger version

Name:	image.png
Views:	205
Size:	98.5 KB
ID:	1271347

      Comment


        #4
        Hello tkaboris,

        "how do i find high bar length in price level, not in number of points"

        You are asking for length as in number of bars, but expressed as a price?

        Or you are asking for the height as in High minus Low?

        The value circled on your screenshot does not appear to be a length but appears to be the price a few ticks below the bar.

        Are you asking how many bars it is between each HighBar and LowBar?
        Chelsea B.NinjaTrader Customer Service

        Comment


          #5
          i am asking to find a middle of the bullish zigzag leg in price value, not points as was pointed in screenshot.

          Comment


            #6
            Hello tkaboris,

            So the most recent High/Low bar number minus the previous High/Low bar number then divided by 2?
            Chelsea B.NinjaTrader Customer Service

            Comment


              #7
              yes thats what i am looking for

              Comment


                #8
                Hello,

                // if the last direction change was a highbar
                if (ZigZag(DeviationType.Points, 0.5, false).HighBar(0, 1, 100) < ZigZag(DeviationType.Points, 0.5, false).LowBar(0, 1, 100))
                {
                // print the bar located at the absolute distance from the most recent high bar to the most recent low bar, then divide by 2
                int distance = ( Math.Abs( ZigZag(DeviationType.Points, 0.5, false).HighBar(0, 1, 100) - ZigZag(DeviationType.Points, 0.5, false).LowBar(0, 1, 100) ) / 2 );
                Print(Close[ Math.Max(0, ZigZag(DeviationType.Points, 0.5, false).HighBar(0, 1, 100) + distance ] ));
                }
                Chelsea B.NinjaTrader Customer Service

                Comment

                Latest Posts

                Collapse

                Topics Statistics Last Post
                Started by NullPointStrategies, Today, 05:17 AM
                0 responses
                22 views
                0 likes
                Last Post NullPointStrategies  
                Started by argusthome, 03-08-2026, 10:06 AM
                0 responses
                120 views
                0 likes
                Last Post argusthome  
                Started by NabilKhattabi, 03-06-2026, 11:18 AM
                0 responses
                63 views
                0 likes
                Last Post NabilKhattabi  
                Started by Deep42, 03-06-2026, 12:28 AM
                0 responses
                41 views
                0 likes
                Last Post Deep42
                by Deep42
                 
                Started by TheRealMorford, 03-05-2026, 06:15 PM
                0 responses
                45 views
                0 likes
                Last Post TheRealMorford  
                Working...
                X