Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Super Trend For Ninja Trader Needed

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

  • MoreYummy
    replied
    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?

    Leave a comment:


  • tortexal
    replied
    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.

    Leave a comment:


  • WhoKnows
    replied
    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.

    Leave a comment:


  • NinjaTrader_JoshP
    replied
    velocity,

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

    Leave a comment:


  • Alphadirected
    replied
    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

    Leave a comment:


  • roonius
    replied
    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.

    Leave a comment:


  • chkyour6
    replied
    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

    Leave a comment:


  • dj22522
    replied
    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.

    Leave a comment:


  • roonius
    replied
    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

    Leave a comment:


  • chkyour6
    replied
    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.

    Leave a comment:


  • roonius
    replied
    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

    Leave a comment:


  • chkyour6
    replied
    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.
    Attached Files

    Leave a comment:


  • chkyour6
    replied
    thank you for your kind reply.

    bye

    Leave a comment:


  • roonius
    replied
    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
    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
    }

    Leave a comment:


  • NinjaTrader_Bertrand
    replied
    Thanks velocity, could you please reattch this as a zip file? Thanks!

    Leave a comment:

Latest Posts

Collapse

Topics Statistics Last Post
Started by Geovanny Suaza, 02-11-2026, 06:32 PM
0 responses
662 views
0 likes
Last Post Geovanny Suaza  
Started by Geovanny Suaza, 02-11-2026, 05:51 PM
0 responses
376 views
1 like
Last Post Geovanny Suaza  
Started by Mindset, 02-09-2026, 11:44 AM
0 responses
110 views
0 likes
Last Post Mindset
by Mindset
 
Started by Geovanny Suaza, 02-02-2026, 12:30 PM
0 responses
574 views
1 like
Last Post Geovanny Suaza  
Started by RFrosty, 01-28-2026, 06:49 PM
0 responses
580 views
1 like
Last Post RFrosty
by RFrosty
 
Working...
X