Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Super Trend For Ninja Trader Needed

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

    TSSSuperTrend in strategy

    after upgrading to NT7 I also had issues using TSSupertrend in a strategy. I also had the error:

    NinjaTrader.Strategy.Strategy.TSSuperTrend(int,TSS uperTrend.Utility.MovingAverageType, double, int, TSSuperTrend.Utility.SuperTrendMode)' is a method, which is not valid in the given context.

    Here's the good news, I found a solution that worked for me (and with a high probability it will for you...
    For anyone interested in using TSSupertrend in a strategy here's what I did:

    0) remove TSSuperTrend.Utility from indicators directory, and rename file extension of strategy's using TSSupertrend that failed to compile before (or temporarily remove them from strategy directory) so that you can compile without errors.
    1) copy TradingStudies.NinjaScript.Utility.cs to indicators directory
    2) open and compile TradingStudies.NinjaScript.Utility.cs
    3) copy indicator TSSuperTrend.cs (V2.3) to indicators directory
    4) add "using TradingStudies.NinjaScript.Utility; " to declarations section of TSSuperTrend.cs (on top of code )
    5) compile TSSuperTrend.cs
    6) in strategy, add "using TradingStudies.NinjaScript.Utility;" to declarations section on top of page.

    I attached the following files: (modifications listed above are already implemented here)
    TradingStudies.NinjaScript.Utility.cs
    TSSuperTrend.cs (V2.3) : the indicator
    SuperTrendDemo.cs: strategy which shows how to detect if TSSuperTrend switches Long/Short and how to access and print uptrend/downtrend values.

    Hopefully this information can be usefull to some of the NinjaTraders out here...;

    attention update 21-08-2011
    After a discussion with Randy in post #351 to #358 the best way to get it working is to import the SuperTrend Demo strategy directly in NinjaTrader ( ControlPanel File/Utilities/import NinjaScript ) This way, all the referenced indicators and files are included automatically. So the correct procedure would now be:
    1) remove TSSuperTrend.Utility from indicators directory (if existing)
    2) import SuperTrend Demo.zip in NinjaTrader (File/Utilities/import NinjaScript ) This is the strategy with all the indicators and referenced files.

    update 22-08-2011
    updated SuperTrend Demo.zip
    reason: Corrected strategy switching behaviour; strategy entry's where inverse to supertrend indicator. If supertrend switched to uptrend, the strategy went short, and went long if supertrend swithed to downtrend. Althought this might in fact be very profitable in a sideways market, I thought for clarity it is better to make the switching follow the indicator's up/downtrend.


    good luck,
    Marco
    Attached Files
    Last edited by marcow; 08-21-2011, 04:31 PM.

    Comment


      MA

      Originally posted by roonius View Post
      Vrathee,

      Enjoy,

      You're more than welcome...
      Edit: Added Arrows to indicate possible reversal...
      GREAT INDICATOR....CAN IT BE USED IN MARKET ANALYZER?

      Comment


        any updates?, alerts?, audio file link-ins? made to this indice?

        also, has anyone fixed its bar repaint issue?

        or has anyone observed just howmany bars it takes before it goes back and posts its famous arrows?

        thanks

        Comment


          Compiler Error

          First...thanks to all who contributed to the SuperTrend indicator development.

          I'm trying to code a very simple strategy that uses the basic SuperTrend indicator that comes with NT7. I keep getting a compiler error "NinjaTrader.Indicator.SuperTrend.Trend is inaccessible due to it's protection level". Based on google research, I have found it may something to do with the overload syntax, but I am not sure. I was trying to follow the roadmap Roonius presented earlier in this thread. Trend does exist as a bool series in the SuperTrend indicator code. Here is my code that generates the compiler error...

          if (!SuperTrend(14, 2.66, true).Trend[0] && SuperTrend(14, 2.66, true).Trend[1])


          If any one can help me see the error of my ways, it would be greatly appreciated..


          Originally posted by roonius View Post
          Velocity,

          Thanks.


          You don't need to add any additional "signal"
          TSSupertrend already has a boolseries:

          Uptrend:
          Code:
           
          if(TSSuperTrend(Parameters).Trend[0])
          {
           //we are in uptrend
          }
          Downtrend:
          Code:
           
          if(!TSSuperTrend(Parameters).Trend[0])
          {
           //we are in downtrend
          }
          Fresh cross up:

          Code:
           
          if(TSSuperTrend(Parameters).Trend[0] && !SuperTrend(Parameters)[1])
          {
           //Trend just changed direction up
          }
          Fresh cross down:

          Code:
           
          if(!TSSuperTrend(Parameters).Trend[0] && SuperTrend(Parameters)[1])
          {
           //Trend just changed direction down
          }

          Comment


            Issue solved with the help of NinjaTrader_Ryan in another thread...

            Comment


              Originally posted by marcow View Post
              after upgrading to NT7 I also had issues using TSSupertrend in a strategy. I also had the error:

              NinjaTrader.Strategy.Strategy.TSSuperTrend(int,TSS uperTrend.Utility.MovingAverageType, double, int, TSSuperTrend.Utility.SuperTrendMode)' is a method, which is not valid in the given context.

              Here's the good news, I found a solution that worked for me (and with a high probability it will for you...
              For anyone interested in using TSSupertrend in a strategy here's what I did:

              0) remove TSSuperTrend.Utility from indicators directory, and rename file extension of strategy's using TSSupertrend that failed to compile before (or temporarily remove them from strategy directory) so that you can compile without errors.
              1) copy TradingStudies.NinjaScript.Utility.cs to indicators directory
              2) open and compile TradingStudies.NinjaScript.Utility.cs
              3) copy indicator TSSuperTrend.cs (V2.3) to indicators directory
              4) add "using TradingStudies.NinjaScript.Utility; " to declarations section of TSSuperTrend.cs (on top of code )
              5) compile TSSuperTrend.cs
              6) in strategy, add "using TradingStudies.NinjaScript.Utility;" to declarations section on top of page.

              I attached the following files: (modifications listed above are already implemented here)
              TradingStudies.NinjaScript.Utility.cs
              TSSuperTrend.cs (V2.3) : the indicator
              SuperTrendDemo.cs: strategy which shows how to detect if TSSuperTrend switches Long/Short and how to access and print uptrend/downtrend values.

              Hopefully this information can be usefull to some of the NinjaTraders out here...;

              good luck,
              Marco
              Marco,

              I have imported the two files, and the first file compiled fine.

              When I tried to compile the second file, I got the following error message:

              The name "SMMA" does not exist in the current context (Code CSO103), Line 62, Column 36
              The name 'HomodyneDiscriminator' does not exist in the current context (Code CSO103), Line 101, Column 49

              Is there an update that addresses this issue, or can you suggest a fix for this?

              Thanks for your help, and thanks for sharing this SuperTrend update fix or NT7.

              Randy

              Comment


                Randy,

                from the error messages I assume you're talking about the file TSSuperTrend.cs, right ? I think the problem is that you don't have the SMMA and HomodyneDiscriminator indicator in your indicators directory , please verify.

                Did you first remove TSSuperTrend.Utility from the indicators directory, and then copy TradingStudies.NinjaScript.Utility.cs into this directory ?

                does TSSuperTrend.cs compile with TSSuperTrend.Utility (and NOT TradingStudies.NinjaScript.Utility.cs ) in the indicators directory ?

                Also did you exactly follow step 0 to 6 ? please report at wich step you get the error message.


                Marco

                Comment


                  Marco,

                  Yes, I was referring to the TSSuperTrend.cs file.

                  You are correct that I do not have the SMMA indicator or the HomodyneDiscriminator indicator in my indicator directory, so I am sure that is why I am having the problem.

                  I guess I mistakenly assumed files you posted contained all the necessary components.

                  Are the proper SMMA or the HomodyneDiscriminator indicator files on this forum or if not, do you have a link to get them?

                  Thanks for your help.

                  Randy



                  Randy,

                  from the error messages I assume you're talking about the file TSSuperTrend.cs, right ? I think the problem is that you don't have the SMMA and HomodyneDiscriminator indicator in your indicators directory , please verify.

                  Did you first remove TSSuperTrend.Utility from the indicators directory, and then copy TradingStudies.NinjaScript.Utility.cs into this directory ?

                  does TSSuperTrend.cs compile with TSSuperTrend.Utility (and NOT TradingStudies.NinjaScript.Utility.cs ) in the indicators directory ?

                  Also did you exactly follow step 0 to 6 ? please report at wich step you get the error message.

                  Comment


                    please find attached a zip file with the 2 indicators.

                    to import:
                    In NinjaTrader control panel go to File/Utilities/import NinjaScript and then select the attached zip file and press ok.

                    please let me know if it works now...

                    Marco
                    Attached Files

                    Comment


                      Marco,

                      Many thanks, that fixed it.

                      In your original post, what is does the SuperTrendDemo.cs do?

                      Randy

                      Comment


                        Marco,

                        I am not sure if I am doing this correctly, but this is what I did with the SuperTrendDemo.cs file.

                        I moved the file into my NinjaTrader 7 strategies folder. I then tried to compile the strategy, but I got the following error message.

                        The type or namespace name 'SuperTrendDemo' does not exist in the namespace 'NinjaTrader.Indicator' (are you missing an assemble reference?) Code CS0234. Lines 166, 175, 192, 201

                        Is this an easy edit in the namespace area of the NinjaScript? Or maybe it is referencing another indicator that I don't have named SuperTrendDemo?

                        Thanks again,

                        Randy

                        Comment


                          Randy,

                          the error is not from the strategy because it only has 114 lines of code...

                          I've succesfully -without errors- exported the strategy including all the indicators and files it references and attached the file.
                          Please remove the previous files ( supertrend indicator and strategy and TradingStudies.NinjaScript.Utility.cs ) and import the attachment in the control panel with File/Utilities/import NinjaScript. Does it work now ?

                          About your question in your previous post :
                          the SuperTrendDemo.cs is a strategy which uses the TSSsuperTrend indicator. The purpose of this "demo" strategy is to show how to "readout" the supertrend indicator and go Long/Short when the indicator switches from long to short. See lines 60 to 75 in the strategy.

                          does that make sense ?

                          Marco
                          Attached Files

                          Comment


                            Thanks, this has solved all of my issues.

                            Thanks very much for your patience and I really appreciate your help. Have a great weekend.

                            Randy

                            Comment


                              Randy,

                              great that you got it working now !

                              I've updated post # 346 and added the attachment of the strategy with included indicators and referenced files.

                              have a great weekend.

                              Marco

                              Comment


                                Hi all. What parameters do you use for the super trend strategy?

                                I'm backtesting this on the TF and it's not looking so good...Thanks in advance.

                                Comment

                                Latest Posts

                                Collapse

                                Topics Statistics Last Post
                                Started by Segwin, 05-07-2018, 02:15 PM
                                14 responses
                                1,788 views
                                0 likes
                                Last Post aligator  
                                Started by Jimmyk, 01-26-2018, 05:19 AM
                                6 responses
                                837 views
                                0 likes
                                Last Post emuns
                                by emuns
                                 
                                Started by jxs_xrj, 01-12-2020, 09:49 AM
                                6 responses
                                3,293 views
                                1 like
                                Last Post jgualdronc  
                                Started by Touch-Ups, Today, 10:36 AM
                                0 responses
                                12 views
                                0 likes
                                Last Post Touch-Ups  
                                Started by geddyisodin, 04-25-2024, 05:20 AM
                                11 responses
                                62 views
                                0 likes
                                Last Post halgo_boulder  
                                Working...
                                X