Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

H&S Indicator for NT8

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

    H&S Indicator for NT8

    Originally posted by NinjaTrader_PatrickH View Post
    Hello all,

    Thank you for your posts.

    We will upload the updated HSIdentify and HSBasicDef for NinjaTrader 8 once it has been converted.
    Hi,

    NinjaTrader_RyanM did a great job of writing the H&S indicators in April and May 2013 issues of TASC (Dr. Siligardos' article on logarithmically defining and identifying H&Ss). Statistically, this is the most useful price pattern used by professionals.

    We are still waiting for this real useful indicator to be converted for sometime now. Like you, NinjaTrader_Paul also indicated a conversion several months ago. Surprisingly, the conversion is straight forward and simple.

    Meanwhile, I have converted these pair indicators for NT8 using the conversion tools on this forum. Both indicators compiled fine and HSBasicDef seems to run OK, but HSIdentify will generate an error when applied to a chart:

    "Value of property "Period" of NinjaScript "MAX" is 0 and not in valid range between 1 and 2147483647."

    Looking at the required syntax, I can't see why this error is generated even after including some print statements (commented out). However, this is the only one error keeping the indicator from being implemented.

    I am attaching the NT8 version of these two indicators, perhaps NT can suggest one or two alternative line code needed to fix this one error until a formal conversion is available.

    Many thanks.
    Attached Files

    #2
    Hello Aligator,

    I add the following on line 181 to HSBasicDef,

    Print(CurrentBar +"|"+ tl2b);

    Right above,

    h2 = MAX(Close, CurrentBar - tl2b)[CurrentBar - p1b];

    Open the output window and add apply the HSBasicDef indicator to a chart and I see that CurrentBar and tl2b become equal which would be the issue for the error. You cannot have a zero value for the period parameter of the MAX function.

    Please let us know if you need further assistance.
    Attached Files
    Alan P.NinjaTrader Customer Service

    Comment


      #3
      Originally posted by NinjaTrader_AlanP View Post
      Hello Aligator,

      I add the following on line 181 to HSBasicDef,

      Print(CurrentBar +"|"+ tl2b);

      Right above,

      h2 = MAX(Close, CurrentBar - tl2b)[CurrentBar - p1b];

      Open the output window and add apply the HSBasicDef indicator to a chart and I see that CurrentBar and tl2b become equal which would be the issue for the error. You cannot have a zero value for the period parameter of the MAX function.

      Please let us know if you need further assistance.
      Thank you AlanP.

      I also noted similar issue when I first printed values. The conversion is simple and as seen in attached screenshot the code for NT7 and NT8 are very similar and definition for h2 and the logic for determining tl2b value are the same in both NT7 and NT8. The only difference I see is the new syntax for ".Set" as highlighted in small blue boxes.

      What really is confusing is that the NT7 code plots fine but the NT8 version produces error, considering that both have the exact code and logic for h2 and tl2b.

      Why NT7 plots and NT8 version produces error? Is it possible that NT7 version includes a bug that is not picked but causes error in NT8 conversion?

      Many thanks.
      Attached Files

      Comment


        #4
        Hello Aligator,

        While the blocks of code are the same the values of the variables computed above may be different.

        I would suggest adding print statements to both NT7 and NT8 and comparing the prints to confirm you are working with the same figures.

        Regarding converting the indicator, I’d like to mention its best to do a manual conversion for accuracy as not all scripts are simple enough to be converted directly.

        Also below I’ve provided a link to code breaking changes which you should consider when converting your scripts:


        PatrickH was savvy enough to figure out the conversion and has posted it here,


        Please let us know if you need further assistance.
        Last edited by NinjaTrader_AlanP; 12-13-2017, 08:30 AM.
        Alan P.NinjaTrader Customer Service

        Comment


          #5
          Originally posted by NinjaTrader_AlanP View Post
          Hello Aligator,

          While the blocks of code are the same the values of the variables computed above may be different.

          I would suggest adding print statements to both NT7 and NT8 and comparing the prints to confirm you are working with the same figures.

          Regarding converting the indicator, I’d like to mention its best to do a manual conversion for accuracy as not all scripts are simple enough to be converted directly.

          Also below I’ve provided a link to code breaking changes which you should consider when converting your scripts:


          Ironically this Monday I finished this indicator as my final assignment for my NinjaScript training. I wrote it in NT8 using the Head & Shoulders Algorithmically Part 1 and Part 2 articles by Giorgos Siligardos and did not peek at the NT7 version. It hasn’t been approved yet and the official converted version they do still plan to release.

          Attached is the indicator along with a workspace (HS Testing1.txt) for which if you have the data you should see the patterns displayed. You'll need to change the .txt to .xml of the workspace file then and save it to your Workspace folder.

          Please let us know if you need further assistance.
          Fantastic! Thanks a bunch AlanP.

          I have always thought It would have been more efficient to combine the twin indicators into one, and you have done it. Great work!

          I have played a little with your indicator and it seems to include some bonus printing of labels. However, it seems to be drawing incomplete H&S on just about every last bar including all parameters and no history. Perhaps, it might be helpful if you take a look at the NT7 Version to reproduce the intended patterns as discussed in the article. I see that the original features of NT7 version like plotting history, box, etc. options are not included.

          Hopefully, when NT releases a NT8 conversion it would also include an option for Inverse H&S which is just as useful and important for oversold conditions and trend reversals at bottoms.

          Again, appreciate your help and many thanks.

          Fixing the one error in the HSBasicDef code as I am posting again should reproduce the same results as NT7 version.
          Attached Files
          Last edited by aligator; 01-22-2017, 05:56 PM.

          Comment


            #6
            Originally posted by NinjaTrader_AlanP View Post
            Hello Aligator,

            While the blocks of code are the same the values of the variables computed above may be different.

            I would suggest adding print statements to both NT7 and NT8 and comparing the prints to confirm you are working with the same figures.

            Regarding converting the indicator, I’d like to mention its best to do a manual conversion for accuracy as not all scripts are simple enough to be converted directly.

            Also below I’ve provided a link to code breaking changes which you should consider when converting your scripts:


            Ironically this Monday I finished this indicator as my final assignment for my NinjaScript training. I wrote it in NT8 using the Head & Shoulders Algorithmically Part 1 and Part 2 articles by Giorgos Siligardos and did not peek at the NT7 version. It hasn’t been approved yet and the official converted version they do still plan to release.

            Attached is the indicator along with a workspace (HS Testing1.txt) for which if you have the data you should see the patterns displayed. You'll need to change the .txt to .xml of the workspace file then and save it to your Workspace folder.

            Please let us know if you need further assistance.


            Alan, Thank you for posting your version of the H&S. One thing I like is that you have combine the "Define" and "Identify" parts into one indicator instead of two separate indicator.

            However, the main optional feature of the original NT7 indicator that allows plotting of historical S&H is missing. This is perhaps the most useful feature that allows study of past patterns.

            Also, your indicator shows formation of the last H&S on the current bar only and is removed on a new bar. I was not able to replicate your H&S template unless I use data that ends on the same date as your template.

            I assume one needs to run a Market Analyzer (MA) of a watch list i.e. SP500 to identify stocks with a H&S formation on current bar. However, the indicator does not have the logic to be used in MA.

            I still believe a direct conversion of the NT7 version (Converted NT8 Files in Post #1) would preserve all the features (i.e. history, etc.), and certainly combining the two part indicators into one indicator would be a bonus.

            Many Thanks.

            Comment


              #7
              Hello Alligator,

              Correct, the version of the indicator I built was to identify a head and shoulders relative to the current bar, which is how I interpreted the article. As I mentioned this was a training assignment and not an official conversion. I agree, seeing the historical HS patterns is very nice and useful.

              The issue with the conversion is line 183, as you pointed out. Once this has been resolved on our end the conversion will be released and I do not have any additional information regarding when that will be.

              Please let us know if you need further assistance.
              Alan P.NinjaTrader Customer Service

              Comment


                #8
                Originally posted by NinjaTrader_AlanP View Post
                Hello Alligator,

                The issue with the conversion is line 183, as you pointed out. Once this has been resolved on our end the conversion will be released and I do not have any additional information regarding when that will be.

                Please let us know if you need further assistance.
                AlanP, Hi.

                The NT8 version was posted by PatrickH, thank you all.

                Any chance you can elaborate on the logic for how the line 183 issue was resolved and the use of -1 for indexing in NT8?

                I am converting the new NT8 HSBasicDef version to a Reverse H&S, it compiles fine buy having similar indexing issue.

                Thanks.

                Comment


                  #9
                  Hello aligator,

                  The resolution was if the number being passed as the bar index was equal to or less than 0, make it 1.

                  In the converted HSIdentify, you can see line 86 for an example,

                  Code:
                  double	w		= MAX(Close, CurrentBar - l3b <= 0 ? 1 : CurrentBar - l3b)[0];
                  Please let us know if you need further assistance.
                  Alan P.NinjaTrader Customer Service

                  Comment

                  Latest Posts

                  Collapse

                  Topics Statistics Last Post
                  Started by jclose, Today, 09:37 PM
                  0 responses
                  5 views
                  0 likes
                  Last Post jclose
                  by jclose
                   
                  Started by WeyldFalcon, 08-07-2020, 06:13 AM
                  10 responses
                  1,413 views
                  0 likes
                  Last Post Traderontheroad  
                  Started by firefoxforum12, Today, 08:53 PM
                  0 responses
                  11 views
                  0 likes
                  Last Post firefoxforum12  
                  Started by stafe, Today, 08:34 PM
                  0 responses
                  11 views
                  0 likes
                  Last Post stafe
                  by stafe
                   
                  Started by sastrades, 01-31-2024, 10:19 PM
                  11 responses
                  169 views
                  0 likes
                  Last Post NinjaTrader_Manfred  
                  Working...
                  X