Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Improvement to ZigZag Indicator

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

    Improvement to ZigZag Indicator

    Hi Folks,

    I tried the ZigZag indicator on a volume-based chart using the data from replay connection. I need the following improvement.
    1) Update ZigZag Low High point on the current bar which is still in formation. I noticed it only update it on the completed bar if any update is possible. Although in the setup it is calculate on every tick, it didn't work on the latest bar. (For a SMA indicator, I can observe its working on the latest tick if I set it up to calculate on every tick.)
    2) After ZigZag high is formed, If there is any new bar with its high higher than the zig zag high, update it immediately. It only add a new zigzag low point after at least N bars without new update on zigzag high, and the low of a forming bar is M+ points to the last zigzag high.
    3) After ZigZag low is formed, if there is any new bar with its low lower than the zig zag low update it immediately. It only add a new zigzag high point after at least N bars without new update on zigzag low, and the high of a forming bar is M+ points to the last zigzag low.

    2) and 3) is actually the same logic.

    I went through the code of ZigZag.But I have no idea how to make the modifications.

    Attached a sample picture. By doing the above 1, 2, 3), it can remove the spikes in the picture.
    Click image for larger version

Name:	ES 03-21 (560 Volume) 2021_02_24 (9_28_52 AM).png
Views:	83
Size:	59.4 KB
ID:	1145116

    Please guide me how to modified the zigzag indicator. Many thanks! I am using NT8.



    Best Regards
    David WANG

    #2
    Hello David,

    Thanks for your post.

    We may be able to give some direction, but we could not offer a direct path without actually making thee modifications for you.

    With regards to #1, you will need to modify the indicator so it assigns plot values with BarsAgo 0 instead of BarsAgo 1. The ZigZag indicator currently always calculates 1 bar ago.

    With regards to #2 and #3, I am not sure if this is what you want. When I test on the Simulated Data Feed, keeping the market moving in 1 direction, the ZigZag does get updated with the new high or low, although this happens for at least 1 bar ago, depending on the Calculate mode.

    If you want to filter spikes, you can keep track of bar indexes when ZigZag highs and lows are formed, and if you encounter a new ZigZag Low when the last ZigZag Low was 2 bars ago, or N bars ago, you can update the the previous ZigZag Low with the new found ZigZag Low, and you could consider resetting the last ZigZag high.

    Series<double>.Reset() - https://ninjatrader.com/support/help...nt8/?reset.htm

    This would be the most I could offer for initial insight. Anyone wishing to tackle the task may find other obstacles while trying these modifications and getting something to work.

    If you are interested in services to have a modification made for you, we would suggest enlisting the services of a NinjaScript Consultant.

    If that interests you, please let me know.
    JimNinjaTrader Customer Service

    Comment


      #3
      Originally posted by NinjaTrader_Jim View Post
      Hello David,

      Thanks for your post.

      We may be able to give some direction, but we could not offer a direct path without actually making thee modifications for you.

      With regards to #1, you will need to modify the indicator so it assigns plot values with BarsAgo 0 instead of BarsAgo 1. The ZigZag indicator currently always calculates 1 bar ago.

      With regards to #2 and #3, I am not sure if this is what you want. When I test on the Simulated Data Feed, keeping the market moving in 1 direction, the ZigZag does get updated with the new high or low, although this happens for at least 1 bar ago, depending on the Calculate mode.

      If you want to filter spikes, you can keep track of bar indexes when ZigZag highs and lows are formed, and if you encounter a new ZigZag Low when the last ZigZag Low was 2 bars ago, or N bars ago, you can update the the previous ZigZag Low with the new found ZigZag Low, and you could consider resetting the last ZigZag high.

      Series<double>.Reset() - https://ninjatrader.com/support/help...nt8/?reset.htm

      This would be the most I could offer for initial insight. Anyone wishing to tackle the task may find other obstacles while trying these modifications and getting something to work.

      If you are interested in services to have a modification made for you, we would suggest enlisting the services of a NinjaScript Consultant.

      If that interests you, please let me know.
      Hi, please give me the list of NinjaScript Consultant.

      Thank you!

      Comment


        #4
        Hello sinpeople,

        Thank you for your post.

        You can search our list of NinjaScript consultants through the link below. Simply enter a consultant name or search by using our filter categories. Once you have identified your consultants of choice, please visit each consultant's site for more information or contact them directly to learn more:
        You can locate the contact information for the consultants on their direct websites for any additional questions you may have. Since these consultants are third-party services for NinjaTrader, all pricing and support information will need to be obtained through the consultant.

        The NinjaTrader Ecosystem website is for educational and informational purposes only and should not be considered a solicitation to buy or sell a futures contract or make any other type of investment decision. The companies and services listed on this website are not to be considered a recommendation and it is the reader's responsibility to evaluate any product, service, or company. NinjaTrader Ecosystem, LLC is not responsible for the accuracy or content of any product, service or company linked to on this website.

        Let me know if I may be of further assistance.
        Thomas C.NinjaTrader Customer Service

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by MatthewLesko, Yesterday, 07:59 PM
        1 response
        12 views
        0 likes
        Last Post StealthM93  
        Started by RookieKiwi, Yesterday, 06:53 PM
        1 response
        11 views
        0 likes
        Last Post NinjaTrader_EricB  
        Started by Skyfly1715, Yesterday, 08:10 PM
        2 responses
        8 views
        0 likes
        Last Post s.kinra
        by s.kinra
         
        Started by max333, Yesterday, 09:05 PM
        0 responses
        6 views
        0 likes
        Last Post max333
        by max333
         
        Started by VolatyTrading, Yesterday, 07:57 PM
        0 responses
        3 views
        0 likes
        Last Post VolatyTrading  
        Working...
        X