Announcement

Collapse

Looking for a User App or Add-On built by the NinjaTrader community?

Visit NinjaTrader EcoSystem and our free User App Share!

Have a question for the NinjaScript developer community? Open a new thread in our NinjaScript File Sharing Discussion Forum!
See more
See less

Partner 728x90

Collapse

Accelerator Bands NT8

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

    Accelerator Bands NT8

    I'm trying to get a code written for the Accelerator Bands for NT8. I have the following code below, but believe this is only compatible for NT7. Does any have the NT8 code for this, or can I get assistance on converting this code to be compatible for NT8? Thanks

    //
    // Copyright (C) 2006, NinjaTrader LLC <www.ninjatrader.com>.
    // NinjaTrader reserves the right to modify or overwrite this NinjaScript component with each release.
    //

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

    // This namespace holds all indicators and is required. Do not change it.
    namespace NinjaTrader.Indicator
    {
    /// <summary>
    /// Acceleration_Bands Bands are plotted at standard deviation levels above and below a moving average. Since standard deviation is a measure of volatility, the bands are self-adjusting: widening during volatile markets and contracting during calmer periods.
    /// http://www.ninjatrader-support2.com/...ands#post45609
    /// 1/18/10 - zeller4 -
    /// </summary>
    [Description("Acceleration_Bands Bands are plotted at standard deviation levels above and below a moving average. Since standard deviation is a measure of volatility, the bands are self-adjusting: widening during volatile markets and contracting during calmer periods.")]
    public class Acceleration_Bands : Indicator
    {
    #region Variables
    private int period = 20;

    private DataSeries candleDirection;
    private DataSeries signal;
    private DataSeries accelBandUpper1;
    private DataSeries accelBandLower1;

    #endregion

    /// <summary>
    /// This method is used to configure the indicator and is called once before any bar data is loaded.
    /// </summary>
    protected override void Initialize()
    {
    Add(new Plot(new Pen(Color.Maroon,2), PlotStyle.Line, "Upper band1"));
    Add(new Plot(new Pen(Color.White,2), PlotStyle.Line, "Middle band1"));
    Add(new Plot(new Pen(Color.Maroon,2), PlotStyle.Line, "Lower band1"));

    // Plots[0].Pen.DashStyle = DashStyle.DashDotDot;
    // Plots[2].Pen.DashStyle = DashStyle.DashDotDot;

    CalculateOnBarClose = false;
    AutoScale = false;
    DrawOnPricePanel = true;
    Overlay = true;
    DisplayInDataBox = false;
    PriceTypeSupported = true;

    signal = new DataSeries(this);
    accelBandUpper1 = new DataSeries(this);
    accelBandLower1 = new DataSeries(this);
    // accelBandUpper2 = new DataSeries(this);
    // accelBandLower2 = new DataSeries(this);

    }

    /// <summary>
    /// Called on each bar update event (incoming tick)
    /// </summary>
    protected override void OnBarUpdate()
    {
    if (CurrentBar < period) return;

    accelBandUpper1.Set(High[0] * (1 + 4 * (High[0] - Low[0]) / (High[0] + Low[0])));
    accelBandLower1.Set(Low[0] * (1 - 4 * (High[0] - Low[0]) / (High[0] + Low[0])));
    // accelBandUpper2.Set(High[0] * (1 + 2 * (((High[0] - Low[0]) / ((High[0] + Low[0])/2))*1000)*.001 ));
    // accelBandLower2.Set(Low[0] * (1 - 2 * (((High[0] - Low[0]) / ((High[0] + Low[0])/2))*1000)*.001 ));




    Upper1.Set(SMA(accelBandUpper1,period)[0]);
    Middle1.Set(SMA(period)[0]);
    Lower1.Set(SMA(accelBandLower1,period)[0]);


    }

    #region Properties
    [Browsable(false)] [XmlIgnore()] public DataSeries Upper1 { get { return Values[0]; } }
    [Browsable(false)] [XmlIgnore()] public DataSeries Middle1 { get { return Values[1]; } }
    [Browsable(false)] [XmlIgnore()] public DataSeries Lower1 { get { return Values[2]; } }


    [Description("Numbers of bars used for calculations")]
    [Category("Parameters")]
    public int Period
    {
    get { return period; }
    set { period = Math.Max(1, value); }
    }


    [Browsable(false)] [XmlIgnore()] public DataSeries Signal { get { return signal; } }



    #endregion
    }
    }

    #region NinjaScript generated code. Neither change nor remove.
    // This namespace holds all indicators and is required. Do not change it.
    namespace NinjaTrader.Indicator
    {
    public partial class Indicator : IndicatorBase
    {
    private Acceleration_Bands[] cacheAcceleration_Bands = null;

    private static Acceleration_Bands checkAcceleration_Bands = new Acceleration_Bands();

    /// <summary>
    /// Acceleration_Bands Bands are plotted at standard deviation levels above and below a moving average. Since standard deviation is a measure of volatility, the bands are self-adjusting: widening during volatile markets and contracting during calmer periods.
    /// </summary>
    /// <returns></returns>
    public Acceleration_Bands Acceleration_Bands(int period)
    {
    return Acceleration_Bands(Input, period);
    }

    /// <summary>
    /// Acceleration_Bands Bands are plotted at standard deviation levels above and below a moving average. Since standard deviation is a measure of volatility, the bands are self-adjusting: widening during volatile markets and contracting during calmer periods.
    /// </summary>
    /// <returns></returns>
    public Acceleration_Bands Acceleration_Bands(Data.IDataSeries input, int period)
    {
    checkAcceleration_Bands.Period = period;
    period = checkAcceleration_Bands.Period;

    if (cacheAcceleration_Bands != null)
    for (int idx = 0; idx < cacheAcceleration_Bands.Length; idx++)
    if (cacheAcceleration_Bands[idx].Period == period && cacheAcceleration_Bands[idx].EqualsInput(input))
    return cacheAcceleration_Bands[idx];

    Acceleration_Bands indicator = new Acceleration_Bands();
    indicator.BarsRequired = BarsRequired;
    indicator.CalculateOnBarClose = CalculateOnBarClose;
    indicator.Input = input;
    indicator.Period = period;
    indicator.SetUp();

    Acceleration_Bands[] tmp = new Acceleration_Bands[cacheAcceleration_Bands == null ? 1 : cacheAcceleration_Bands.Length + 1];
    if (cacheAcceleration_Bands != null)
    cacheAcceleration_Bands.CopyTo(tmp, 0);
    tmp[tmp.Length - 1] = indicator;
    cacheAcceleration_Bands = tmp;
    Indicators.Add(indicator);

    return indicator;
    }

    }
    }

    // This namespace holds all market analyzer column definitions and is required. Do not change it.
    namespace NinjaTrader.MarketAnalyzer
    {
    public partial class Column : ColumnBase
    {
    /// <summary>
    /// Acceleration_Bands Bands are plotted at standard deviation levels above and below a moving average. Since standard deviation is a measure of volatility, the bands are self-adjusting: widening during volatile markets and contracting during calmer periods.
    /// </summary>
    /// <returns></returns>
    [Gui.Design.WizardCondition("Indicator")]
    public Indicator.Acceleration_Bands Acceleration_Bands(int period)
    {
    return _indicator.Acceleration_Bands(Input, period);
    }

    /// <summary>
    /// Acceleration_Bands Bands are plotted at standard deviation levels above and below a moving average. Since standard deviation is a measure of volatility, the bands are self-adjusting: widening during volatile markets and contracting during calmer periods.
    /// </summary>
    /// <returns></returns>
    public Indicator.Acceleration_Bands Acceleration_Bands(Data.IDataSeries input, int period)
    {
    return _indicator.Acceleration_Bands(input, period);
    }

    }
    }

    // This namespace holds all strategies and is required. Do not change it.
    namespace NinjaTrader.Strategy
    {
    public partial class Strategy : StrategyBase
    {
    /// <summary>
    /// Acceleration_Bands Bands are plotted at standard deviation levels above and below a moving average. Since standard deviation is a measure of volatility, the bands are self-adjusting: widening during volatile markets and contracting during calmer periods.
    /// </summary>
    /// <returns></returns>
    [Gui.Design.WizardCondition("Indicator")]
    public Indicator.Acceleration_Bands Acceleration_Bands(int period)
    {
    return _indicator.Acceleration_Bands(Input, period);
    }

    /// <summary>
    /// Acceleration_Bands Bands are plotted at standard deviation levels above and below a moving average. Since standard deviation is a measure of volatility, the bands are self-adjusting: widening during volatile markets and contracting during calmer periods.
    /// </summary>
    /// <returns></returns>
    public Indicator.Acceleration_Bands Acceleration_Bands(Data.IDataSeries input, int period)
    {
    if (InInitialize && input == null)
    throw new ArgumentException("You only can access an indicator with the default input/bar series from within the 'Initialize()' method");

    return _indicator.Acceleration_Bands(input, period);
    }

    }
    }
    #endregion
    -EC_Chris-
    NinjaTrader Ecosystem Vendor - Emergent Cybernetics

    #2
    Thanks for the note.

    I have forwarded this item to our business development team who can then refer you to a NinjaScript consultant that would convert your code.

    If you would like to convert this code yourself, we have a fully documented help guide which will help you get started with Ninja Script. You will find language references to all of the methods and functions you will be using. You will also see a tutorial section which will help you create your first indicator and get you started with some of these concepts.

    A link to our Help Guide can be found below: https://ninjatrader.com/support/help...injascript.htm

    If you decide to work on converting this item yourself and have further questions, I can provide further information where it may be needed.

    I look forward to being of further assistance.
    JesseNinjaTrader Customer Service

    Comment


      #3
      Hello EC_Chris,

      Thank you for contacting us and for your interest in NinjaTrader!

      You can search our extensive library of vendors who provide programming services through the link below. Simply enter a consultant name or search by using our filter categories. Once you have identified your consultants of choice, please visit each consultant's site for more information or contact them directly to learn more!


      You can locate the contact information for the consultants on their direct websites for any additional questions you may have. Since these consultants are third party services for NinjaTrader all pricing and support information will need to be obtained through the consultant.

      This NinjaTrader Ecosystem website is for educational and informational purposes only and should not be considered a solicitation to buy or sell a futures contract or make any other type of investment decision. The companies and services listed on this website are not to be considered a recommendation and it is the reader's responsibility to evaluate any product, service, or company. NinjaTrader Ecosystem LLC is not responsible for the accuracy or content of any product, service or company linked to on this website.

      Please let me know if you have any questions, concerns or if I can provide any further assistance by responding to this thread at your convenience.
      Ryan L.NinjaTrader Customer Service

      Comment

      Latest Posts

      Collapse

      Topics Statistics Last Post
      Started by techgetgame, Today, 11:42 PM
      0 responses
      5 views
      0 likes
      Last Post techgetgame  
      Started by sephichapdson, Today, 11:36 PM
      0 responses
      1 view
      0 likes
      Last Post sephichapdson  
      Started by bortz, 11-06-2023, 08:04 AM
      47 responses
      1,612 views
      0 likes
      Last Post aligator  
      Started by jaybedreamin, Today, 05:56 PM
      0 responses
      9 views
      0 likes
      Last Post jaybedreamin  
      Started by DJ888, 04-16-2024, 06:09 PM
      6 responses
      19 views
      0 likes
      Last Post DJ888
      by DJ888
       
      Working...
      X