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

NT8's Version of SuperTrend - How to use?

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

    NT8's Version of SuperTrend - How to use?

    Hi all,

    In the process of converting old NT7 files to NT8. One of them used SuperTrend from NT7, but I can't call the indicator the same way.

    I imported the following SuperTrend indicator recoded for NT8. I imported everything in the zip file:


    And this was the old code I used in Ninjatrader 7:
    Code:
    //  All SuperTrend variables are set here
    					ST_UpTrend_Signal = SuperTrend(14, 3, true).UpArrow[1];
    					ST_DownTrend_Signal = SuperTrend(14, 3, true).DownArrow[1];
    					ST_UpTrend_State = SuperTrend(14, 3, true).UpTrendState[1];
    					ST_UpTrend_State_Prev = SuperTrend(14, 3, true).UpTrendState[2];
    					ST_DownTrend_State = SuperTrend(14, 3, true).DownTrendState[1];
    					ST_DownTrend_State_Prev = SuperTrend(14, 3, true).DownTrendState[2];
    I've been trying to look for examples to show how the NT8 version is written using the Ninjascript editor. Can anyone point me in the right direction?

    Thanks in advance!

    #2
    Hello Spiderbird,

    Thank you for the post.

    It appears the author of the NT8 item provided has changed the name from what you were using if that was the anaSuperTrend items.

    Additionally, I am unsure what the code looked like for the NT7 "SuperTrend" indicator to confirm if this was done the same, assuming this was a direct conversion I do not see the same "SuperTrend" indicator included.

    The syntax you have provided has 3 parameters and is called by "SuperTrend". I do not see a "SuperTrend" specifically in this pack of items for NT8. I do see AuSuperTrendU11 which may be the conversion for anaSuperTrendU11.

    Do you know if the "SuperTrend" in NT7 was specifically the anaSuperTrendU11 or was this a separate indicator that was in addition to the ana-prefixed items? If the SuperTrend is an item you download from a paid membership with another site, we could additionally work through email. If you could provide the SuperTrend indicator its self, we could review if that references items in the NT8 pack and can be remade in the same way.


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

    Comment


      #3
      Hi Jesse,

      My apologies. It looks like this is a new SuperTrend indicator that was recoded for NT8. The one I was using was here: https://ninjatrader.com/support/foru...ght=supertrend

      So, if I were to adopt this particular one, and call it out in Ninjascript, how would I go about doing that?

      I can open up the Indicator in the NT Editor, but I'm trying to figure out what I can call from that indicator to replace what I have in my current code.

      Any bits of advice or direction would be great if you have the time.

      - R

      Comment


        #4
        So I can kind of answer my own question.

        An easy way to figure out your options is just to type out the beginning of the indicator in the editor (in this case, "AuSuperTrendU11") and seeing the arguments it takes. It's a bit cryptic, and you have to figure out what arguments are valid. But that's the easier option.

        But I'm still left wondering what to put in there. Here's the full line of what AuSuperTrendU11 has:

        Code:
        AuSuperTrendU11(AuSuperTrendU11BaseType, AuSuperTrendU11OffsetType, AuSuperTrendU11VolaType, bool reverseIntraBar, int basePeriod, double multiplier, int rangePeriod)
        And again, I have no idea how to map it to this:
        Code:
        ST_UpTrend_Signal = SuperTrend(14, 3, true).UpArrow[1];
        					ST_DownTrend_Signal = SuperTrend(14, 3, true).DownArrow[1];
        Help, clues, pity?
        Last edited by Spiderbird; 07-14-2018, 05:03 PM.

        Comment


          #5
          Hello Spiderbird,

          Thank you for your response.

          I would recommend contacting the developer of the conversion for further assistance on this indicator.

          For the overloads, if you open the 'AuSuperTrendU11' indicator in the NinjaScript Editor and then expand the 'Global Enums' region you will see the required values for the enumerations.

          Comment


            #6
            Originally posted by NinjaTrader_PatrickH View Post
            For the overloads, if you open the 'AuSuperTrendU11' indicator in the NinjaScript Editor and then expand the 'Global Enums' region you will see the required values for the enumerations.
            Hi Patrick,

            I’m not sure what you mean. Is that something different when what I posted above for the available parameters I can choose from?

            Comment


              #7
              Hello SpiderBird,

              Thank you for your response.

              You need to review the indicator that you are working with. Look at it's parameters when you add it to a chart and in it's code.

              The bold parameters below are called 'enums'. You will need to know what option you want to use for these.
              Code:
              AuSuperTrendU11([B]AuSuperTrendU11BaseType, AuSuperTrendU11OffsetType, AuSuperTrendU11VolaType[/B], bool reverseIntraBar, int basePeriod, double multiplier, int rangePeriod)
              For example, AuSuperTrendU11BaseType has the options of the following Median, ADXVMA, Butterworth_2, Butterworth_3, DEMA, DSMA, DTMA, DWMA, Ehlers, EMA, Gauss_2, Gauss_3, Gauss_4, HMA, HoltEMA, LinReg, LLMA, SMA, SuperSmoother_2, SuperSmoother_3, TEMA, TMA, TSMA, TWMA, VWMA, WMA, ZeroLagHATEMA, ZeroLagTEMA, and finally ZLEMA.

              Let's say you want to use the EMA option, you would then set that in the parameters of the indicator's function call as such:
              Code:
              AuSuperTrendU11([B]AuSuperTrendU11BaseType.EMA[/B], AuSuperTrendU11OffsetType, AuSuperTrendU11VolaType], bool reverseIntraBar, int basePeriod, double multiplier, int rangePeriod)
              This line is not a full line of code and you will still need to add the other parameters.

              You need to familiarize yourself with the indicator and check with the developer for further clarification.

              Comment


                #8
                Hi Patrick,

                Thanks for your time and help. What I struggled with was trying to locate where those enums were in the NT editor, or how to surface them. Would you advise opening the code of the indicator and looking for " public enum ..." to get all of the enum options, or just surface those in the NT editor?

                If the latter, what's the recommended way of doing it?
                Thanks in advance for your time. This should be the last question.

                Comment


                  #9
                  Hello Spiderbird,

                  Thank you for your response.

                  Open the 'AuSuperTrendU11' indicator in the NinjaScript Editor and at the top you will see a region called 'Global Enums', expand this region to see the options that are available.

                  Please let me know if you have any questions.

                  Comment


                    #10
                    Great!

                    Thanks for that Patrick! One last thing. Here's the line of code I have that utilizes what's in global enums as a reference point:

                    Code:
                    ST_UpTrend_Signal = AuSuperTrendU11(AuZeroLagHATEMA, AuZeroLagTEMA, Standard_Deviation, true, 14, 3, 3).UpArrow[1];
                    The problem is the 'Standard_Deviation' argument up above. It points back to this line in the indicator:

                    Code:
                    public enum AuSuperTrendU11VolaType { Simple_Range, True_Range, Standard_Deviation }
                    None of those are recognized by the NT editor, as it spits back "The name "Standard_Deviation" does not exist in the current context.". I tried looking for an indicator with either Simple_Range, True_Range or some variation of it, but nothing was there. I also tried putting in a number there, but it gives an overload message.

                    What am I doing wrong?

                    Comment


                      #11
                      Hello SpiderBird,

                      Thank you for your response.

                      Below is an example of how to call the enums.
                      Code:
                      double testValue = AuSuperTrendU11(AuSuperTrendU11BaseType.EMA, AuSuperTrendU11OffsetType.EMA, AuSuperTrendU11VolaType.Standard_Deviation, true, 14, 3, 3)[0];
                      Please let me know if I may be of further assistance.

                      Comment


                        #12
                        Thanks again Patrick. I'm set. Really appreciate your patience.

                        Comment

                        Latest Posts

                        Collapse

                        Topics Statistics Last Post
                        Started by aa731, Today, 02:54 AM
                        1 response
                        6 views
                        0 likes
                        Last Post NinjaTrader_BrandonH  
                        Started by BarzTrading, Today, 07:25 AM
                        0 responses
                        2 views
                        0 likes
                        Last Post BarzTrading  
                        Started by i019945nj, 12-14-2023, 06:41 AM
                        5 responses
                        65 views
                        0 likes
                        Last Post i019945nj  
                        Started by ruudawakening, Today, 12:58 AM
                        1 response
                        8 views
                        0 likes
                        Last Post NinjaTrader_Jesse  
                        Started by thread, Yesterday, 11:58 PM
                        1 response
                        8 views
                        0 likes
                        Last Post NinjaTrader_ChelseaB  
                        Working...
                        X