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 "Bars ago" refers to...

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

    Zigzag "Bars ago" refers to...

    Hi,

    I wonder if Zigzag's Bars ago refers to previous ZigzagHigh/Low, or just previous bars?

    What I want to do is to compare the existing close (0) with the previous ZigzagHigh/Low (1), (2)... etc. Thx.

    calvin
    Attached Files

    #2
    calvin, this would really refer to the previous bars, not the previous found ZigZag High / Low point instance, for this you needed to custom code with the methods it offers for access - http://www.ninjatrader-support.com/H...V6/ZigZag.html
    BertrandNinjaTrader Customer Service

    Comment


      #3
      How do I access the ZigZag value?

      I tried it with a indicator (which only had a Print() statement), and according to the http://www.ninjatrader-support.com/H...eToNinjaTrader I used the right syntax. However, the values are quite different than from the chart. I double-checked everything and tried the different ways to output the ZigZag value, but to no avail. Does anything have an idea how to correctly access the ZigZag indicator value?

      Here's what I included in the Print() statement:
      Code:
      [FONT=Courier New][SIZE=1][FONT=Courier New][SIZE=1]
      Print(Time[[/SIZE][/FONT][/SIZE][/FONT][FONT=Courier New][SIZE=1][COLOR=#800080][FONT=Courier New][SIZE=1][COLOR=#800080][FONT=Courier New][SIZE=1][COLOR=#800080]0[/COLOR][/SIZE][/FONT][/COLOR][/SIZE][/FONT][/COLOR][/SIZE][/FONT][FONT=Courier New][SIZE=1][FONT=Courier New][SIZE=1]].ToString() + [/SIZE][/FONT][/SIZE][/FONT][FONT=Courier New][SIZE=1][COLOR=#800000][FONT=Courier New][SIZE=1][COLOR=#800000][FONT=Courier New][SIZE=1][COLOR=#800000]" current zigzag high: "[/COLOR][/SIZE][/FONT][/COLOR][/SIZE][/FONT][/COLOR][/SIZE][/FONT][FONT=Courier New][SIZE=1][FONT=Courier New][SIZE=1] + ZigZag(DeviationType.Percent, [/SIZE][/FONT][/SIZE][/FONT][FONT=Courier New][SIZE=1][COLOR=#800080][FONT=Courier New][SIZE=1][COLOR=#800080][FONT=Courier New][SIZE=1][COLOR=#800080]1[/COLOR][/SIZE][/FONT][/COLOR][/SIZE][/FONT][/COLOR][/SIZE][/FONT][FONT=Courier New][SIZE=1][FONT=Courier New][SIZE=1], [/SIZE][/FONT][/SIZE][/FONT][FONT=Courier New][SIZE=1][COLOR=#0000ff][FONT=Courier New][SIZE=1][COLOR=#0000ff][FONT=Courier New][SIZE=1][COLOR=#0000ff]true[/COLOR][/SIZE][/FONT][/COLOR][/SIZE][/FONT][/COLOR][/SIZE][/FONT][FONT=Courier New][SIZE=1][FONT=Courier New][SIZE=1]).ZigZagHigh[[/SIZE][/FONT][/SIZE][/FONT][FONT=Courier New][SIZE=1][COLOR=#800080][FONT=Courier New][SIZE=1][COLOR=#800080][FONT=Courier New][SIZE=1][COLOR=#800080]0[/COLOR][/SIZE][/FONT][/COLOR][/SIZE][/FONT][/COLOR][/SIZE][/FONT][FONT=Courier New][SIZE=1][FONT=Courier New][SIZE=1]] +
      [/SIZE][/FONT][/SIZE][/FONT][FONT=Courier New][SIZE=1][COLOR=#800000][FONT=Courier New][SIZE=1][COLOR=#800000][FONT=Courier New][SIZE=1][COLOR=#800000]" current zigzag Low: "[/COLOR][/SIZE][/FONT][/COLOR][/SIZE][/FONT][/COLOR][/SIZE][/FONT][FONT=Courier New][SIZE=1][FONT=Courier New][SIZE=1] + ZigZag(DeviationType.Percent, [/SIZE][/FONT][/SIZE][/FONT][FONT=Courier New][SIZE=1][COLOR=#800080][FONT=Courier New][SIZE=1][COLOR=#800080][FONT=Courier New][SIZE=1][COLOR=#800080]1[/COLOR][/SIZE][/FONT][/COLOR][/SIZE][/FONT][/COLOR][/SIZE][/FONT][FONT=Courier New][SIZE=1][FONT=Courier New][SIZE=1], [/SIZE][/FONT][/SIZE][/FONT][FONT=Courier New][SIZE=1][COLOR=#0000ff][FONT=Courier New][SIZE=1][COLOR=#0000ff][FONT=Courier New][SIZE=1][COLOR=#0000ff]true[/COLOR][/SIZE][/FONT][/COLOR][/SIZE][/FONT][/COLOR][/SIZE][/FONT][FONT=Courier New][SIZE=1][FONT=Courier New][SIZE=1]).ZigZagLow[[/SIZE][/FONT][/SIZE][/FONT][FONT=Courier New][SIZE=1][COLOR=#800080][FONT=Courier New][SIZE=1][COLOR=#800080][FONT=Courier New][SIZE=1][COLOR=#800080]0[/COLOR][/SIZE][/FONT][/COLOR][/SIZE][/FONT][/COLOR][/SIZE][/FONT][FONT=Courier New][SIZE=1][FONT=Courier New][SIZE=1]]);
      [/SIZE][/FONT][/SIZE][/FONT]
      However, that didn't give the correct values.

      How can I use the ZigZag indicator values in another indicator? (Say, for instance, if I wanted to plot arrows above and below the ZigZag high and low?)

      Comment


        #4
        J_o_s, the Swing / ZigZag indicators are more used for visuals and would 'backfit' their results - I would suggest you plot the ZigZagHigh and ZigZagLow values to see which data is expected to be returned on the bar you attempt to access them programmatically.
        BertrandNinjaTrader Customer Service

        Comment


          #5
          Thank you for your quick response Bertrand.
          Originally posted by NinjaTrader_Bertrand View Post
          J_o_s, the Swing / ZigZag indicators are more used for visuals and would 'backfit' their results - I would suggest you plot the ZigZagHigh and ZigZagLow values to see which data is expected to be returned on the bar you attempt to access them programmatically.
          I'm sorry but could you please elaborate? Changing the indicator settings to High or Low instead of close doesn't change the output, and the Print() statement already used the high and low values.

          I want to do something very simple: plot a line below the graph which shows the cumulative total of the potential profits. So, the sum of the top High and the bottom Low. That way you get an idea if an market, time frame, or time period has profit potential or not. Does someone know a good indicator which can make such an line possible? It seems that ZigZag isn't suited for this, just as the Swing indicator, MAX and MIN functions.

          Honestly, it's quite disappointing to already spend 10+ hours on this and still have no idea how to make such a simple thing in NinjaScript. I've got to wonder which kind of education one needs to work with NinjaScript.

          Any thoughts are highly appreciated,

          Regards,

          Comment


            #6
            J_o_s, there's for sure a learning curve involved as you're dealing with a true programming language here, the advantage is the almost infinite flexibility and performance you can gain. The Max / perfect profit indicator is not as simple to program as you might imagine - my point was simply that the ZigZag swings you see on the chart visually could not be accessed at the exact same points in time on the chart programmatically as you would only be sure the point x in the past was such a swing / zig zag turn point as a number of bars, points or percentage move would have passed in the 'other' direction. The values returned programmatically (the prints) would give you an idea which value was being calculated at this point in realtime running the indicators.
            BertrandNinjaTrader Customer Service

            Comment


              #7
              Thanks for your quick reply Bertrand.

              Originally posted by NinjaTrader_Bertrand View Post
              J_o_s, there's for sure a learning curve involved as you're dealing with a true programming language here, the advantage is the almost infinite flexibility and performance you can gain. The Max / perfect profit indicator is not as simple to program as you might imagine - my point was simply that the ZigZag swings you see on the chart visually could not be accessed at the exact same points in time on the chart programmatically as you would only be sure the point x in the past was such a swing / zig zag turn point as a number of bars, points or percentage move would have passed in the 'other' direction. The values returned programmatically (the prints) would give you an idea which value was being calculated at this point in realtime running the indicators.
              Yes, you're right. The learning curve (something I quite struggle with) has the benefit of greater flexibility, and that's a strong point. My disappointed comments earlier in this thread are thus more reflective of my frustrations than the quality of NinjaTrader. Sorry.


              Thanks for your further elaboration Bertrand, it seems to me we where both trying to say the same thing. Just got to keep trying I guess, and from the bright side: everything that doesn't work is a step closer to something that does.





              Regards,

              Comment

              Latest Posts

              Collapse

              Topics Statistics Last Post
              Started by Sulfred, 03-23-2020, 10:21 PM
              3 responses
              5,320 views
              0 likes
              Last Post NinjaTrader_ChelseaB  
              Started by Vulgoth_t_Destroyer, 05-09-2022, 04:45 PM
              58 responses
              6,079 views
              0 likes
              Last Post NinjaTrader_ChelseaB  
              Started by dniezby, Today, 06:15 AM
              0 responses
              2 views
              0 likes
              Last Post dniezby
              by dniezby
               
              Started by Duckman1074, Today, 05:59 AM
              0 responses
              9 views
              0 likes
              Last Post Duckman1074  
              Started by ruina, Yesterday, 04:21 AM
              4 responses
              33 views
              0 likes
              Last Post ruina
              by ruina
               
              Working...
              X