Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Super Trend For Ninja Trader Needed

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

    Originally posted by chkyour6 View Post
    Regarding the indicator above I have developed a simple strategy where the code, as indicated previously, is the following :

    if (Position.MarketPosition == MarketPosition.Flat && TSSuperTrend(Periodo, TradingStudies.NinjaScript.Utility.MovingAverageTy pe.SMA, 2.618, 14, TradingStudies.NinjaScript.Utility.SuperTrendMode. ATR).Trend[0])
    {

    EnterLong(DefaultQuantity, "");
    }
    else if(Position.MarketPosition == MarketPosition.Long && !TSSuperTrend(Periodo, TradingStudies.NinjaScript.Utility.MovingAverageTy pe.SMA, 2.618, 14, TradingStudies.NinjaScript.Utility.SuperTrendMode. ATR).Trend[0] && TSSuperTrend(Periodo, TradingStudies.NinjaScript.Utility.MovingAverageTy pe.SMA, 2.618, 14, TradingStudies.NinjaScript.Utility.SuperTrendMode. ATR).Trend[1])
    {

    ExitLong();
    }


    but as you can see in the attached file it doesn't work fine.

    The trend start at a position where the boolean variable is non true.

    Is it correct or I'm wrong ?

    I think that, as in the code above, the Order Long start at the beginning of the trend, after the first bar of a trend.

    Thank you in advance

    bye.
    Make sure that indicator on the screen has the same parameters as indicator in your strategy.

    According to your posted code and screenshot they are not the same

    Comment


      In the code above the screenshot and the strategy have the same parameters.

      In particular Periodo=14 and indicator in the graph and strategy are working with the same parameters.

      May you try it?

      Thanks.

      Comment


        Originally posted by chkyour6 View Post
        In the code above the screenshot and the strategy have the same parameters.

        In particular Periodo=14 and indicator in the graph and strategy are working with the same parameters.

        May you try it?

        Thanks.
        I see SMA in the code and HMA on the screen

        Comment


          Candle bars full colour

          Firstly many thanks for this Super Trend.
          As I'm still hopeless at programming such things, it's great help to have such contributions.

          Using the "Colour Bar" option, for say an up bar that has a close higher than its' open, the body of the candle is not coloured, just it's outline is coloured.

          May I ask if it's possible, when using "colour bar" option, to have the body of the candle bar to be fully coloured, regrdless of where the bar close is in relation to it's open. ?

          Also, when "Calculate on bar close" is set to "False", the bars colour incorrectly.
          Can this be corrected ?

          Many thx
          Last edited by dj22522; 06-03-2009, 07:23 PM.

          Comment


            I'm sorry I'm wrong. You are right roonius.
            When I written strategy I was very tired and I confused it.

            Thank you for your kind indication. Now I will try it.

            bye

            Comment


              Originally posted by dj22522 View Post
              Firstly many thanks for this Super Trend.
              As I'm still hopeless at programming such things, it's great help to have such contributions.

              Using the "Colour Bar" option, for say an up bar that has a close higher than its' open, the body of the candle is not coloured, just it's outline is coloured.

              May I ask if it's possible, when using "colour bar" option, to have the body of the candle bar to be fully coloured, regrdless of where the bar close is in relation to it's open. ?

              Also, when "Calculate on bar close" is set to "False", the bars colour incorrectly.
              Can this be corrected ?

              Many thx
              Corrected?
              With parameters - no.
              With code change - yes.
              Feel free to play with code and modify it.

              Comment


                Originally posted by velocity View Post
                I created a data series "bsSignal" to add a +1 when you're in an Uptrend and -1 when you're in a Downtrend. So now all you need to do is code your Strategy using +1 / -1 as a condition in the Strategy Wizard. No need for programing!!

                Good Luck
                Hello, I'm new to NT and sorry for the stupid question. How do I import this? I tried creating my own ZIP after I downloaded it to desktop but get a NT error message saying it wans't created by NT.

                Thank you

                Comment


                  velocity,

                  It would be appreciated if you could please repost your file from an export zip so users can import them. Thank you.
                  Josh P.NinjaTrader Customer Service

                  Comment


                    Just FYI,

                    Aparently Roonius built his latest version (TSSuperTrend 2.1,post 217, with improved speed/efficiency) not on the version before that by EW (SuperTrend2.1, post 210).

                    Therefore the 4th Algo Fixed Percent and the Zerolags disappeared from the last version.

                    I did not look yet in the code what Velocity used as base.


                    BTW If you renew the TSSuperTrend.cs don't forget to also renew (allow overscribing when importing the ZIP) to the correct version of TradingStudies.NinjaScript.Utility.cs
                    Last edited by WhoKnows; 06-05-2009, 05:41 AM.

                    Comment


                      this will work, long and short.

                      #region Using declarations
                      using System;
                      using System.ComponentModel;
                      using System.Diagnostics;
                      using System.Drawing;
                      using System.Drawing.Drawing2D;
                      using System.Xml.Serialization;
                      using NinjaTrader.Cbi;
                      using NinjaTrader.Data;
                      using NinjaTrader.Indicator;
                      using NinjaTrader.Gui.Chart;
                      using NinjaTrader.Strategy;
                      #endregion

                      // This namespace holds all strategies and is required. Do not change it.
                      namespace NinjaTrader.Strategy
                      {
                      /// <summary>
                      /// Enter the description of your strategy here
                      /// </summary>
                      [Description("Enter the description of your strategy here")]
                      public class testSuperTrend : Strategy
                      {
                      #region Variables

                      #endregion

                      /// <summary>
                      /// This method is used to configure the strategy and is called once before any strategy method is called.
                      /// </summary>
                      protected override void Initialize()
                      {
                      CalculateOnBarClose = true;


                      Add(DynamicSR(21));
                      Add(SuperTrend(10, 3));
                      Add(CCI_Histogram(14)) ;
                      Add(ElliotOscillator(5, 35));
                      }

                      /// <summary>
                      /// Called on each bar update event (incoming tick)
                      /// </summary>
                      protected override void OnBarUpdate()
                      {
                      //go long
                      if
                      (Close[0] > DynamicSR(21).Resistance[0] && Close[0] > SuperTrend(10, 3).UpTrend[0]
                      && CCI_Histogram(14).CCIoversold[0] > 0 && ElliotOscillator(5, 34).Uptrend[0] > 0)
                      {
                      EnterLong(DefaultQuantity, "");
                      }

                      //stop if closes under dynamic S
                      if (Position.MarketPosition == MarketPosition.Long && Close[0] < DynamicSR(21).Support[0])
                      { ExitLong();
                      }

                      //go short if everything indicated short
                      if (Close[0] < DynamicSR(21).Support[0] && Close[0] < SuperTrend(10, 3).DownTrend[0]
                      && CCI_Histogram(14).CCIoversold[0] < 0 && ElliotOscillator(5, 34).Uptrend[0] < 0)
                      {
                      EnterShort();
                      }

                      //cover short if close above dynamic R
                      if (Position.MarketPosition == MarketPosition.Short && Close[0] > DynamicSR(21).Resistance[0])
                      {
                      ExitShort();
                      }

                      }

                      #region Properties

                      #endregion
                      }
                      }
                      Last edited by tortexal; 06-07-2009, 11:03 PM.

                      Comment


                        Originally posted by velocity View Post
                        I created a data series "bsSignal" to add a +1 when you're in an Uptrend and -1 when you're in a Downtrend. So now all you need to do is code your Strategy using +1 / -1 as a condition in the Strategy Wizard. No need for programing!!

                        Good Luck
                        Where do I put this file?

                        After this file is in its place, just use this bsSignal as parameter in strategy wizard with other conditions?

                        Comment


                          C:\Documents and Settings\your user folder\My Documents\NinjaTrader 6.5\bin\Custom\Indicator

                          Answer to your second question. YES

                          Comment


                            After I put in the folder, where do I see the "bsSignal" parameter in Strategy Wizard?

                            I checked TSSuperTrend Indicator, I dont see "bsSignal"

                            I just checked out the whole thread, there are more than 1 version of TSSuperTrend. Im using the first attachment at the beginning of the thread. Could it be the issue?

                            I also downloaded both SuperTrend and TSSuperTrend. And the TSSuperTrend.cs file and replaced the original one from TSSuperTrend, no luck finding "bsSignal" in Strategy Wizard under either SuperTrend nor TSSuperTrend.
                            Last edited by MoreYummy; 06-10-2009, 07:25 PM. Reason: added more info

                            Comment


                              You would need to use the cs file from post # 220. It will give you the 'Signal' Plot to work with in the wizard.
                              BertrandNinjaTrader Customer Service

                              Comment


                                Originally posted by tortexal View Post
                                this will work, long and short.

                                #region Using declarations
                                using System;
                                using System.ComponentModel;
                                using System.Diagnostics;
                                using System.Drawing;
                                using System.Drawing.Drawing2D;
                                using System.Xml.Serialization;
                                using NinjaTrader.Cbi;
                                using NinjaTrader.Data;
                                using NinjaTrader.Indicator;
                                using NinjaTrader.Gui.Chart;
                                using NinjaTrader.Strategy;
                                #endregion

                                // This namespace holds all strategies and is required. Do not change it.
                                namespace NinjaTrader.Strategy
                                {
                                /// <summary>
                                /// Enter the description of your strategy here
                                /// </summary>
                                [Description("Enter the description of your strategy here")]
                                public class testSuperTrend : Strategy
                                {
                                #region Variables

                                #endregion

                                /// <summary>
                                /// This method is used to configure the strategy and is called once before any strategy method is called.
                                /// </summary>
                                protected override void Initialize()
                                {
                                CalculateOnBarClose = true;


                                Add(DynamicSR(21));
                                Add(SuperTrend(10, 3));
                                Add(CCI_Histogram(14)) ;
                                Add(ElliotOscillator(5, 35));
                                }

                                /// <summary>
                                /// Called on each bar update event (incoming tick)
                                /// </summary>
                                protected override void OnBarUpdate()
                                {
                                //go long
                                if
                                (Close[0] > DynamicSR(21).Resistance[0] && Close[0] > SuperTrend(10, 3).UpTrend[0]
                                && CCI_Histogram(14).CCIoversold[0] > 0 && ElliotOscillator(5, 34).Uptrend[0] > 0)
                                {
                                EnterLong(DefaultQuantity, "");
                                }

                                //stop if closes under dynamic S
                                if (Position.MarketPosition == MarketPosition.Long && Close[0] < DynamicSR(21).Support[0])
                                { ExitLong();
                                }

                                //go short if everything indicated short
                                if (Close[0] < DynamicSR(21).Support[0] && Close[0] < SuperTrend(10, 3).DownTrend[0]
                                && CCI_Histogram(14).CCIoversold[0] < 0 && ElliotOscillator(5, 34).Uptrend[0] < 0)
                                {
                                EnterShort();
                                }

                                //cover short if close above dynamic R
                                if (Position.MarketPosition == MarketPosition.Short && Close[0] > DynamicSR(21).Resistance[0])
                                {
                                ExitShort();
                                }

                                }

                                #region Properties

                                #endregion
                                }
                                }
                                I'm new to this so pardon my ignorance. I can't get that to compile. Using "SuperTrend" it doesn't know what I'm talking about, but changing that to "TSSuperTrend" clears that error. The next error is about the number of arguments TSSupertrend is looking for.

                                Is there a "latest" or "common" version of the indicator in use or has this been developed down to paths? What version did you write that strategy for, tortextal?

                                Getting more familiar with the NinjaScript interface today... a good thing but frustrating for my neophyte self

                                Comment

                                Latest Posts

                                Collapse

                                Topics Statistics Last Post
                                Started by Balage0922, Today, 07:38 AM
                                0 responses
                                3 views
                                0 likes
                                Last Post Balage0922  
                                Started by JoMoon2024, Today, 06:56 AM
                                0 responses
                                6 views
                                0 likes
                                Last Post JoMoon2024  
                                Started by Haiasi, 04-25-2024, 06:53 PM
                                2 responses
                                19 views
                                0 likes
                                Last Post Massinisa  
                                Started by Creamers, Today, 05:32 AM
                                0 responses
                                6 views
                                0 likes
                                Last Post Creamers  
                                Started by Segwin, 05-07-2018, 02:15 PM
                                12 responses
                                1,786 views
                                0 likes
                                Last Post Leafcutter  
                                Working...
                                X