Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

is there a way to add parallel lines to a simple moving average on a ninja chart?

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

    is there a way to add parallel lines to a simple moving average on a ninja chart?

    is there a way to add parallel lines to a simple moving average on a ninja chart?

    on what daily bar price is the SMA indicator calculated [i.e.] open, high, low, close, etc?
    Last edited by joemiller; 02-05-2016, 01:50 PM.

    #2
    Hello joemiller,

    Thanks for your post.

    The standard Bollinger indicator (middle line) is a simple moving average with a period you can set. The upper and lower lines are exactly the same except they are multiplied by a standard deviation value to set them above and below the middle line. You can adjust the standard deviation amount to move the lines closer or further away. It may not be exactly what you want but is something you can look at pretty quickly.

    If that does not meet your needs you may want to search through the forums file sharing area, here is a link: http://ninjatrader.com/support/forum...4&sort=N&pp=15

    If you find nothing then you can always create it yourself using NinjaScript.
    Paul H.NinjaTrader Customer Service

    Comment


      #3
      thanks paul...much appreciated.

      on what daily bar price is the SMA indicator calculated [i.e.] open, high, low, close, etc?

      regarding ''If you find nothing then you can always create it yourself using NinjaScript''
      ... where can I find info about how to do that?
      Last edited by joemiller; 02-05-2016, 03:45 PM.

      Comment


        #4
        Hello,

        SMA would be calculated based on close prices by default. This can be adjusted within the Indicators menu using the Input Series property however. With this menu other price types like open, high or low could be set as the input for SMA.



        We do have resources to help you begin creating NinjaScript Strategies/Indicators.
        The best way to begin learning NinjaScriptis to use the Strategy Wizard. With the Strategy Wizard you can setup conditions and variables and then see the generated code in the NinjaScript Editor by clicking the View Code button.

        I'm also proving a link to a pre-recorded 'Automated Strategy Development Webinar' video for you to view at your own convenience: https://www.youtube.com/watch?v=Maaq...56536A44DD7105


        There are a few Sample Automated Strategies which come pre-configured in NinjaTrader that you can use as a starting point. These are found under Tools--> Edit NinjaScript--> Strategy. You will see locked strategies where you can see the details of the code, but you will not be able to edit (you can though always create copies you can later edit via right click > Save as)
        We also have some Reference samples online as well as ‘Tips and Tricks’ for both indicators and strategies:
        Click here to see our NinjaScript Reference Samples: http://www.ninjatrader.com/support/f...ead.php?t=3220
        Click here to see our NinjaScript Tips: http://www.ninjatrader.com/support/f...ead.php?t=3229

        These samples can be downloaded, installed and modified from NinjaTrader and hopefully serve as a good base for your custom works.
        Further, the following link is to our help guide with an alphabetical reference list to all supported methods, properties, and objects that are used in NinjaScript: http://www.ninjatrader.com/support/h..._reference.htm

        We also have a few tutorials in our help guide for both Indicators and Strategies.
        Indicator tutorials: http://www.ninjatrader.com/support/h...ndicators2.htm
        Strategy tutorials: http://www.ninjatrader.com/support/h...strategies.htm
        Please let me know if I can be of further assistance.
        Last edited by NinjaTrader_Kyle; 02-07-2016, 03:48 PM.
        KyleNinjaTrader Customer Service

        Comment


          #5
          In order to obtain a parallel channel from a SMA, you can apply a modified Keltner Channel that allows for using a different period for the average true range compared to the lookback period of the moving average. Below is a screenshot of a Keltner Channel

          - which has a SMA(20) as the center line
          - which uses 2 times the ATR(256) as an offset for the channel lines

          This is basically a quasi-parallel channel that slowly adjusts itself to the volatility of the bars. The adjustment is barely noticeable.

          The indicator also allows to build quasi-parallel channels from 30 other moving averages. I have added a second screenshot that shows an adaptive Laguerre filter with a parallel channel.

          The NT7 indicator is available open source at www.lizardtrader.com.
          Attached Files

          Comment


            #6
            Originally posted by joemiller View Post
            is there a way to add parallel lines to a simple moving average on a ninja chart?

            on what daily bar price is the SMA indicator calculated [i.e.] open, high, low, close, etc?
            1. Create an empty indicator shell using the NT builder for a new indicator.
            2. Replace the sections with these below.

            Code:
                    #region Variables
                    // Wizard generated variables
                    private int bandOffsetTicks = 34; // Default setting for BandOffset
                    private int sMALinePeriod = 13; // Default setting for SMALine
                    // User defined variables (add any user defined variables below)
                    private SMA _sma = null;
                    #endregion
            Code:
                    protected override void OnStartUp()
                    {
                        this._sma = SMA(Input, this.sMALinePeriod);
                    }
            Code:
                    protected override void OnBarUpdate()
                    {
                        // Use this method for calculating your indicator values. Assign a value to each
                        // plot below by replacing 'Close[0]' with your own formula.
                        double smaValue = this._sma.Value[0];
                        
                        UpperBand.Set(smaValue+ this.BandOffsetTicks * TickSize);
                        SMABand.Set(smaValue);
                        LowerBand.Set(smaValue - this.BandOffsetTicks * TickSize);
                    }
            Code:
                    protected override void OnTermination()
                    {
                        if (this._sma != null) this._sma.Dispose();
                    }
            Code:
                    #region Properties
                    [Browsable(false)]    // this line prevents the data series from being displayed in the indicator properties dialog, do not remove
                    [XmlIgnore()]        // this line ensures that the indicator can be saved/recovered as part of a chart template, do not remove
                    public DataSeries UpperBand
                    {
                        get { return Values[0]; }
                    }
            
                    [Browsable(false)]    // this line prevents the data series from being displayed in the indicator properties dialog, do not remove
                    [XmlIgnore()]        // this line ensures that the indicator can be saved/recovered as part of a chart template, do not remove
                    public DataSeries SMABand
                    {
                        get { return Values[1]; }
                    }
            
                    [Browsable(false)]    // this line prevents the data series from being displayed in the indicator properties dialog, do not remove
                    [XmlIgnore()]        // this line ensures that the indicator can be saved/recovered as part of a chart template, do not remove
                    public DataSeries LowerBand
                    {
                        get { return Values[2]; }
                    }
            
                    [Description("Number of Ticks to offset band from SMA plot")]
                    [GridCategory("Parameters")]
                    public int BandOffsetTicks
                    {
                        get { return bandOffsetTicks; }
                        set { bandOffsetTicks = Math.Max(0, value); }
                    }
            
                    [Description("SMA Plot")]
                    [GridCategory("Parameters")]
                    public int SMALinePeriod
                    {
                        get { return sMALinePeriod; }
                        set { sMALinePeriod = Math.Max(1, value); }
                    }
                    #endregion
            Compile. Enjoy!

            If you want a less laggy indicator, consider replacing SMA with TEMA.
            Last edited by koganam; 02-09-2016, 02:39 PM.

            Comment


              #7
              Thanks everyone

              Thanks everyone ... Much apreciated

              Comment

              Latest Posts

              Collapse

              Topics Statistics Last Post
              Started by ZenCortexCLICK, Today, 04:58 AM
              0 responses
              5 views
              0 likes
              Last Post ZenCortexCLICK  
              Started by sidlercom80, 10-28-2023, 08:49 AM
              172 responses
              2,280 views
              0 likes
              Last Post sidlercom80  
              Started by Irukandji, Yesterday, 02:53 AM
              2 responses
              17 views
              0 likes
              Last Post Irukandji  
              Started by adeelshahzad, Today, 03:54 AM
              0 responses
              7 views
              0 likes
              Last Post adeelshahzad  
              Started by Barry Milan, Yesterday, 10:35 PM
              3 responses
              13 views
              0 likes
              Last Post NinjaTrader_Manfred  
              Working...
              X