• Demo счет NinjaTrader, регистрируется в брокерской компании NinjaTrader Brokerage . NinjaTrader™, LLC
    Ссылка на демо счет NinjaTrader
    Фид на соединении Continuum/CQG.
    Для справки: Continuum - это брэнд CQG, и ни чем они не отличаются друг от друга.
  • Сколько я реально плачу комиссии?
    Подробнее по ссылке

Помощь, индикаторы NT8

Dengaz

Member
NinjaTrader
#1
Привет.

Есть код, на NT7, создавал через визард. Точно рисует на 1 секунде )))) на остальных ТФ не хочет.
На NT8 вообще не рисует, создавал через визард. Кто поможет, нужно шоб на NT8 рисовал индюк на любом ТФ.

Код:
#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.Gui.Chart;
#endregion

// This namespace holds all indicators and is required. Do not change it.
namespace NinjaTrader.Indicator
{
    /// <summary>
    /// Enter the description of your new custom indicator here
    /// </summary>
    [Description("Enter the description of your new custom indicator here")]
    public class Polus : Indicator
    {
        #region Variables
        // Wizard generated variables
            private int myInput0 = 1; // Default setting for MyInput0
        // User defined variables (add any user defined variables below)
        #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.Blue, 4), PlotStyle.Hash, "Plot0"));
                           Overlay                = true;
        }

        /// <summary>
        /// Called on each bar update event (incoming tick)
        /// </summary>
        protected override void OnBarUpdate()
        {
            if (Volume[0] > Volume[1]
                && Volume[1] < Volume[2])
            // Use this method for calculating your indicator values. Assign a value to each
            // plot below by replacing 'Close[0]' with your own formula.
            Plot0.Set(Close[1]);
        }

        #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 Plot0
        {
            get { return Values[0]; }
        }

        [Description("")]
        [GridCategory("Parameters")]
        public int MyInput0
        {
            get { return myInput0; }
            set { myInput0 = Math.Max(1, value); }
        }
        #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 Polus[] cachePolus = null;

        private static Polus checkPolus = new Polus();

        /// <summary>
        /// Enter the description of your new custom indicator here
        /// </summary>
        /// <returns></returns>
        public Polus Polus(int myInput0)
        {
            return Polus(Input, myInput0);
        }

        /// <summary>
        /// Enter the description of your new custom indicator here
        /// </summary>
        /// <returns></returns>
        public Polus Polus(Data.IDataSeries input, int myInput0)
        {
            if (cachePolus != null)
                for (int idx = 0; idx < cachePolus.Length; idx++)
                    if (cachePolus[idx].MyInput0 == myInput0 && cachePolus[idx].EqualsInput(input))
                        return cachePolus[idx];

            lock (checkPolus)
            {
                checkPolus.MyInput0 = myInput0;
                myInput0 = checkPolus.MyInput0;

                if (cachePolus != null)
                    for (int idx = 0; idx < cachePolus.Length; idx++)
                        if (cachePolus[idx].MyInput0 == myInput0 && cachePolus[idx].EqualsInput(input))
                            return cachePolus[idx];

                Polus indicator = new Polus();
                indicator.BarsRequired = BarsRequired;
                indicator.CalculateOnBarClose = CalculateOnBarClose;
#if NT7
                indicator.ForceMaximumBarsLookBack256 = ForceMaximumBarsLookBack256;
                indicator.MaximumBarsLookBack = MaximumBarsLookBack;
#endif
                indicator.Input = input;
                indicator.MyInput0 = myInput0;
                Indicators.Add(indicator);
                indicator.SetUp();

                Polus[] tmp = new Polus[cachePolus == null ? 1 : cachePolus.Length + 1];
                if (cachePolus != null)
                    cachePolus.CopyTo(tmp, 0);
                tmp[tmp.Length - 1] = indicator;
                cachePolus = tmp;
                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>
        /// Enter the description of your new custom indicator here
        /// </summary>
        /// <returns></returns>
        [Gui.Design.WizardCondition("Indicator")]
        public Indicator.Polus Polus(int myInput0)
        {
            return _indicator.Polus(Input, myInput0);
        }

        /// <summary>
        /// Enter the description of your new custom indicator here
        /// </summary>
        /// <returns></returns>
        public Indicator.Polus Polus(Data.IDataSeries input, int myInput0)
        {
            return _indicator.Polus(input, myInput0);
        }
    }
}

// This namespace holds all strategies and is required. Do not change it.
namespace NinjaTrader.Strategy
{
    public partial class Strategy : StrategyBase
    {
        /// <summary>
        /// Enter the description of your new custom indicator here
        /// </summary>
        /// <returns></returns>
        [Gui.Design.WizardCondition("Indicator")]
        public Indicator.Polus Polus(int myInput0)
        {
            return _indicator.Polus(Input, myInput0);
        }

        /// <summary>
        /// Enter the description of your new custom indicator here
        /// </summary>
        /// <returns></returns>
        public Indicator.Polus Polus(Data.IDataSeries input, int myInput0)
        {
            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.Polus(input, myInput0);
        }
    }
}
#endregion
Спасибо.
 
Последнее редактирование модератором: