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

zig zag method error

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

    zig zag method error

    I currently use the existing zig zag method

    int FirstUpswingHighPosition = ZigZag(DeviationType.Points, retracement, false).HighBar(0,1,100);

    However i modified the ZigZagindicator and called it ZigZagCustom. I now want to call the same method above using my ZigZag Custom indicator in the same way :

    int FirstUpswingHighPosition = ZigZagCustom(DeviationType.Points, retracement, false).HighBar(0,1,100);

    When i do this i get an error message that says "No overload for method 'zigZagCustom' takes '3' arguments"

    How do i call the original HighPosition Method with my modified ZigZagCustom indicator ?

    thank you,

    #2
    Originally posted by russ123 View Post
    I currently use the existing zig zag method

    int FirstUpswingHighPosition = ZigZag(DeviationType.Points, retracement, false).HighBar(0,1,100);

    However i modified the ZigZagindicator and called it ZigZagCustom. I now want to call the same method above using my ZigZag Custom indicator in the same way :

    int FirstUpswingHighPosition = ZigZagCustom(DeviationType.Points, retracement, false).HighBar(0,1,100);

    When i do this i get an error message that says "No overload for method 'zigZagCustom' takes '3' arguments"

    How do i call the original HighPosition Method with my modified ZigZagCustom indicator ?

    thank you,
    Take a look in the constructor and see,either there`s something`s missing there or some additional parameters added.

    This line you`d need:

    Code:
    return _indicator.ZigZag(input, [B]deviationType, deviationValue, useHighLow[/B]);

    Comment


      #3
      Hello,

      I would like to check how did you make a custom version of the zigzag, did you do the Right click in the original and Save as to create a copy?

      If you had done this process, it should be identical to the original except for having a different name. If you had manually copied the code into a new document this may be the cause if you had missed a public statement for example.

      I would recommend removing the custom version, go back to the original version and Right click and Save as and give the file a new name.

      After doing this the new file will be open, just do a compile and then try the line over again from the other script.

      Doing this process should correct the error you are getting, just remember to comment out the call to the custom indicator during this process so you do not get additional errors.

      I look forward to being of further assistance.
      JesseNinjaTrader Customer Service

      Comment


        #4
        zig zag method

        I replaced the file and now call it the CustomZigZag indicator and the method call worked. however there is an other issue.

        The reason why i updated the ZigZag indicator and created my own CustomZigZag indicator is because the current ZigZag indicator reverses when it encounters a doji. In other words if the deviation value is .01, the Zig Zag indicator is supposed to change direction at a retracement of point .01. However the current indicator actually changes direction if the retracement is 0. So if there is a doji, the ZigZag indicator will change direction.

        This is because of lines in the zig zag code :

        bool isOverHighDeviation = (deviationType == DeviationType.Percent && IsPriceGreater(highSeries[1], (lastSwingPrice * (1.0 + deviationValue * 0.01))))
        || (deviationType == DeviationType.Points && IsPriceGreater(highSeries[1], lastSwingPrice + deviationValue));
        bool isOverLowDeviation = (deviationType == DeviationType.Percent && IsPriceGreater(lastSwingPrice * (1.0 - deviationValue * 0.01), lowSeries[1]))
        || (deviationType == DeviationType.Points && IsPriceGreater(lastSwingPrice - deviationValue, lowSeries[1]));


        If I change the "==" in the above code to ">" and "<", the ZigZag indicator correctly starts changing direction only when there is a retracement and not when there is a doji.

        The problem is that although it plots the zig zag correctly on the chart after the modification, the zig zag METHOD is not returning the correct values.

        ZigZag(DeviationType.Points, retracement, false).HighBar(0,1,100);


        This means additional lines of code need to be updated for the zigzag high bar and low bar methods to return the right values. I need to know what lines need to be updated. Please let me know this.

        Comment


          #5
          Hello,

          Can you please make the change in your custom version of the zigzag and then attach it so I can see what the issue is?

          I believe this is more than likely related to the generated code at the bottom, but I could be wrong so I would like to see the entirety of the code to make a judgment.

          You can attach just the script by clicking the Attach button and browsing to: Documents\NinjaTrader 7\bin\Custom\Indicator

          I look forward to being of further assistance.
          JesseNinjaTrader Customer Service

          Comment

          Latest Posts

          Collapse

          Topics Statistics Last Post
          Started by TheMarlin801, 10-13-2020, 01:40 AM
          20 responses
          3,914 views
          0 likes
          Last Post Bidder
          by Bidder
           
          Started by timmbbo, 07-05-2023, 10:21 PM
          3 responses
          150 views
          0 likes
          Last Post grayfrog  
          Started by Lumbeezl, 01-11-2022, 06:50 PM
          30 responses
          806 views
          1 like
          Last Post grayfrog  
          Started by xiinteractive, 04-09-2024, 08:08 AM
          3 responses
          11 views
          0 likes
          Last Post NinjaTrader_Erick  
          Started by Johnny Santiago, 10-11-2019, 09:21 AM
          95 responses
          6,194 views
          0 likes
          Last Post xiinteractive  
          Working...
          X