Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Super Trend For Ninja Trader Needed

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

    SUCCESS!!

    To anyone interested: I installed Velocity's .cs file from post #220 from this thread as a new indicator. I then had my strat call that indicator instead. See attached pic to see how this thing works. The working code is as follows:

    if (VelocityTrend(14, TradingStudies.NinjaScript.Utility.MovingAverageTy pe.HMA, 1.5, 14, TradingStudies.NinjaScript.Utility.SuperTrendMode. ATR).Signal[0] == 1 && VelocityTrend(14, TradingStudies.NinjaScript.Utility.MovingAverageTy pe.HMA, 1.5, 14, TradingStudies.NinjaScript.Utility.SuperTrendMode. ATR).Signal[1] == -1
    && DoubleMA(5, NinjaTrader.Indicator.DoubleMA_internal.DMAType.HM A, 45, NinjaTrader.Indicator.DoubleMA_internal.DMAType.VM A).Signal[0] == 1)

    Opposite for shorts.

    A great many thanks to Roonius for TSSuperTrend's creation, to Velocity for ending my chainsmoking session and to laparker for his (or her) patience with me yesterday (though you may have to fight Velocity for those naming rights).

    Happy Trading,
    Dave
    Attached Files

    Comment


      Would you please post the .zip for this simple strategy, so that we can copy it and modify it/play with it/improve on it?

      That would help me a lot. Thanks.

      Originally posted by dsraider View Post
      SUCCESS!!
      To anyone interested: I installed Velocity's .cs file from post #220 from this thread as a new indicator. I then had my strat call that indicator instead. See attached pic to see how this thing works. The working code is as follows:

      if (VelocityTrend(14, TradingStudies.NinjaScript.Utility.MovingAverageTy pe.HMA, 1.5, 14, TradingStudies.NinjaScript.Utility.SuperTrendMode. ATR).Signal[0] == 1 && VelocityTrend(14, TradingStudies.NinjaScript.Utility.MovingAverageTy pe.HMA, 1.5, 14, TradingStudies.NinjaScript.Utility.SuperTrendMode. ATR).Signal[1] == -1
      && DoubleMA(5, NinjaTrader.Indicator.DoubleMA_internal.DMAType.HM A, 45, NinjaTrader.Indicator.DoubleMA_internal.DMAType.VM A).Signal[0] == 1)

      Opposite for shorts.

      A great many thanks to Roonius for TSSuperTrend's creation, to Velocity for ending my chainsmoking session and to laparker for his (or her) patience with me yesterday (though you may have to fight Velocity for those naming rights).

      Happy Trading,
      Dave

      Comment


        Simple? SIMPLE? Do you have any idea how much sleep (and hair) I've lost trying to code this thing???



        I'd be happy to post but the actual strat isn't done yet. I'm still working on entries, exits, trails, order cancellation if it gets away from me without filling my limit order entry, 'if marketposition.flat' code to make sure I'm in only one position at a time, and multiple timeframe recognition. I had this set to kick in my ATM originally, but I found out yesterday that ATMs do not adhere to the 'if marketposition.flat' rule. Oh, and I've been coding C# for about ten days now, so this may take awhile

        If it helps, this code goes directly beneath the "protected override void OnBarUpdate ()" line:

        protected override void OnBarUpdate()
        {
        // Enters market when DoubleMA and Trend agree.
        if (VelocityTrend(14, TradingStudies.NinjaScript.Utility.MovingAverageTy pe.HMA, 1.5, 14, TradingStudies.NinjaScript.Utility.SuperTrendMode. ATR).Signal[0] == 1 && VelocityTrend(14, TradingStudies.NinjaScript.Utility.MovingAverageTy pe.HMA, 1.5, 14, TradingStudies.NinjaScript.Utility.SuperTrendMode. ATR).Signal[1] == -1
        && DoubleMA(5, NinjaTrader.Indicator.DoubleMA_internal.DMAType.HM A, 45, NinjaTrader.Indicator.DoubleMA_internal.DMAType.VM A).Signal[0] == 1)
        {
        do something;
        }

        Hope that helps for now...

        Comment


          Yeah. I feel you. It's not that easy to program stuff in ninja. I can't get any strategy using supertrend to paint simpe, buys and sells. So really can't even experiment.

          Comment


            using of supertrend in wizard

            is it possible to use the supertrend as a buy sell signal when coding with the wizard. I did not find out how to. this would be nice for those who are not that smart with programming in code style

            Comment


              Originally posted by dsraider View Post
              Hi All,

              I am in the process of writing a strategy that trades when DoubleMA and TSSuperTrend agree. I was able to successfully compile and test the DoubleMA part alone but cannot, for the life of me, figure out the TSSuperTrend part. I've read through every post of this thread (twice) and none of the suggestions I've tried have worked. I am attaching a zip file of what I have so far. If anyone can post (or edit my current strategy and turn it around to me) I would be forever grateful. In fact, at this point, I'm ready to name my first born child after the successful coder. I am using the latest version if TSSuperTrend (2.3) with the following parameters: 14, HMA, 1.5, 14, ATR. If possible, please write it in such a way that it only trades upon an initial crossover, i.e.: if TSSuperTrend(parameters).UpTrend[0] && !TSSuperTrend(parameters).UpTrend[1] so that I only get one entry per trend crossover.

              Thank you,
              Dave

              Nice Effort dsraider !!!

              Feeling great to be back in forum

              Comment


                Thanks vrathee. I'd export but while it complies and works on my end, NT won't let me do so. I think it has something to do with the second Trend. Don't know. Anyway, following the steps below should work. I'll be posting an automated strat template soon into which people can simply plug in these parameters. A little cutting and pasting, but should be worth it.

                Dave

                Comment


                  Nt7

                  anyone get this to work in NT 7 I can't get it to color bars or show lines?

                  Comment


                    I found out something that I would like to share; it may be usefull to those having problems using the TSSuperTrend 2.1 indicator (post #217) in a strategy.
                    (It's my first post, and since I learnt alot on this forum, I would like to give back something...)

                    according to Roonius in post # 223 you can access the Trend boolseries from a strategy for Uptrend/Downtrend/CrossUP/CrossDown and that you don't need an extra dataseries as introduced in Velocity's version (post #220)

                    It appears that this is correct when the code in Variables is :
                    privatebool colorBars = false;

                    If you set:
                    privatebool colorBars = true;

                    TSSuperTrend(Parameters).Trend[0] will always be False !

                    So what's the reason for this ?
                    the code of TSSuperTrend 2.1 in line 138-149 says:

                    if (colorBars)
                    {
                    CandleOutlineColor = tempColor;
                    if (Open[0] < Close[0] && ChartControl.ChartStyleType == ChartStyleType.CandleStick)
                    {
                    BarColor = Color.Transparent;
                    }
                    else
                    {
                    BarColor = tempColor;
                    }
                    }



                    If I remove/comment out:
                    ChartControl.ChartStyleType == ChartStyleType.CandleStick

                    from the statement in line 141 everything is fine, so there is a problem with this statement.
                    But why is this piece of code setting the Trend Boolseries to always false ?
                    Can some of the more experienced coders have a look at this ?


                    regards,
                    Marco


                    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
                    }

                    update 6/3/2010: the ChartControl.ChartStyleTypeissue reported above applies only to backtesting, in live and or simulated playback everything is fine.
                    Last edited by marcow; 06-02-2010, 08:06 PM. Reason: reported issue applies only to backtesting

                    Comment


                      I need some help with TsSupertrend 2.1 in NT7, when I import and or copy and paste then compile there is one setting in the Parameters that is missing, the price type with the settings close,high,low,median,open and typical. this indicator will not plot the trailing lines on the chart and therefor not change the bar colors. I have however installed the 2.3 version on NT7 and NT6.5 and this does plot the line but still is missing the parameter Price Type. The price type is important to my trade setups, can someone give me a hand or tell me if you are experiencing the same thing?
                      I don't know how to program and am having a difficult time trying to figure out in the code where this setting is.

                      Thank you so much

                      Comment


                        TSSupertrend does not work in NT7Strat Wizard

                        I get a compile error when I try to use TSSupertrend in NT7 strategy wizard...does anyone have the same problem...?

                        Comment


                          DoubleMA indicator

                          Hi DSRaider,

                          I was curious if you are using that DoubleMA in NT7 and if so, can you post it?

                          Blue

                          Comment


                            bluemele,

                            I'm still using 6.5, partly because the DoubleMA doesn't work in 7. Sorry.

                            Dave

                            Originally posted by bluemele View Post
                            Hi DSRaider,

                            I was curious if you are using that DoubleMA in NT7 and if so, can you post it?

                            Blue

                            Comment


                              Hi there,

                              does anybody has the supertrend into a simple configurable thru ninja trader strategy?

                              Comment


                                Does this indicator re-paint?

                                Comment

                                Latest Posts

                                Collapse

                                Topics Statistics Last Post
                                Started by 00nevest, Today, 02:27 PM
                                1 response
                                8 views
                                0 likes
                                Last Post 00nevest  
                                Started by futtrader, 04-21-2024, 01:50 AM
                                4 responses
                                41 views
                                0 likes
                                Last Post futtrader  
                                Started by Option Whisperer, Today, 09:55 AM
                                1 response
                                12 views
                                0 likes
                                Last Post bltdavid  
                                Started by port119, Today, 02:43 PM
                                0 responses
                                8 views
                                0 likes
                                Last Post port119
                                by port119
                                 
                                Started by Philippe56140, Today, 02:35 PM
                                0 responses
                                7 views
                                0 likes
                                Last Post Philippe56140  
                                Working...
                                X