Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Unable to add Multiple Instruments

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

    Unable to add Multiple Instruments

    I am trying to add multiple instruments by
    File->Utilities->Import Stock symbols list

    but I am unable to do so as I use e-signal feed and in that symbols contains "." and/or "-".
    Example symbol of scrip ITC is ITC.EQ-NSE

    How can I import many/multiple stock symbols if I have e-Signal feed and my symbols contain "space" and/or "-" and/or "."

    My NT Version is : 7.0.1000.13

    #2
    Hello vicky2005,

    Thank you for your post.

    Unfortunately, as a consequence of the inclusion of non alphanumeric characters, these symbols will need to be manually configured individually. It is not possible to import a list of symbols which include any character which is not a number or letter.
    KyleNinjaTrader Customer Service

    Comment


      #3
      custom symbols

      Hi I am a newbie here so if I am not observing proper protocol , kindly advise me .I am trying to create a custom index calculated by GOOG - AAPL in an OHLC format. So given a certain time unit i.e. 10am, the 5 m bar for this custom ticker called X would show the highs/low/opens and closes of GOOG-AAPL. I created 4 Add() in initialize. all I am getting are bars which look like the same size. Below is my code and I'd appreciate any help.

      Add(new Plot(Color.FromKnownColor(KnownColor.Orange), PlotStyle.Bar, "Op"));
      Add(new Plot(Color.FromKnownColor(KnownColor.Orange), PlotStyle.Bar, "Hi"));
      Add(new Plot(Color.FromKnownColor(KnownColor.Orange), PlotStyle.Bar, "Lo"));
      Add(new Plot(Color.FromKnownColor(KnownColor.Orange), PlotStyle.Bar, "Cl"));

      Add("GOOD",PeriodType.Day,1);
      Add("AAPL",PeriodType.Day,1);
      Overlay = false;
      }

      /// <summary>
      /// Called on each bar update event (incoming tick)
      /// </summary>
      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.
      Op.Set(Opens[1][0] - Opens[2][0]);
      Hi.Set(Highs[1][0]-Highs[2][0]);
      Lo.Set(Lows[1][0]-Lows[2][0]);
      Cl.Set(Closes[1][0]-Closes[2][0]);

      Comment


        #4
        Hello,

        Welcome to the forums.

        If you check the log tab of the Control Center, you'll find a number of errors.

        I'm not sure if you meant for "GOOD", however if you meant google, it should be GOOG.

        If you are looking for a stock caleld GOOD, you may need to add this to the instrument manager.

        More importantly, you'll find a number of OnBarUpdate errors indicating you're accessing a value outside of the range.

        You will want to put in some CurrentBars checks to ensure that the values you're trying to access actually exist first:

        Code:
        if(CurrentBars[1] < 1 || CurrentBars[2] < 1)
        				return;
        
        Op.Set(Opens[1][0] - Opens[2][0]);
        Hi.Set(Highs[1][0]-Highs[2][0]);
        Lo.Set(Lows[1][0]-Lows[2][0]);
        Cl.Set(Closes[1][0]-Closes[2][0]);
        I would also recommend reading through our documentation on MultiSeries scripts:




        If you continue to receive errors, please let me know what errors are received.
        MatthewNinjaTrader Product Management

        Comment


          #5
          custom tiker

          Hi .Thanks for your response. Totally my fault that I mistyped GOOD. In the actual chart it was GOOG and it was not giving me any compilation errors. In the chart below the primary ticker are solid bars which look like a histogram. Data label on the right of chart shows the last value of the indicator which is accurate i.e. cl(goog)-cl(aapl). However, the indicator clearly does not present the data I need which is to plot the OHLC of Stock 1-stock 2.

          example: 1 hr bar for 10-11am should paint OHLC where Hi=Hi(GOOG)-Hi(AAPL)
          Lo=lo(GOOG)-Lo(AAPL), Op=Op(GOOG)-Op(AAPL) and Cl=Cl(GOOG)-Cl(AAPL)

          Comment


            #6
            I also change the plotstyle from bar to plotstyle.line and was able to calculate 4 values-op,hi,lo,cl BUT there are 4 orange lines instead of 1 OHLC bar per time unit. Is it even possible to present the 4 data points in OHLC format? Below is the code
            Thanks

            in the initialize>>>
            Add(new Plot(Color.Orange, PlotStyle.Line, "Op"));
            Add(new Plot(Color.Orange, PlotStyle.Line, "Hi"));
            Add(new Plot(Color.Orange, PlotStyle.Line, "Lo"));
            Add(new Plot(Color.Orange, PlotStyle.Line, "Cl"));

            in the onbarupdate>>>
            Op.Set(Opens[1][0] - Opens[2][0]);
            Hi.Set(Highs[1][0]-Highs[2][0]);
            Lo.Set(Lows[1][0]-Lows[2][0]);
            Cl.Set(Closes[1][0]-Closes[2][0]);

            Comment


              #7
              Hi,

              There may be other areas of your script that are preventing this from working. Can you please upload the entire script? You will find it in (My) Documents\NinjaTrader 7\bin\Custom\Indicator

              Thanks!
              MatthewNinjaTrader Product Management

              Comment


                #8
                script

                Hi Mathew, The code is WORKING , BUT is drawing 4 separate lines instead of presenting it in an OHLC format. Here is the code.

                This namespace holds all indicators and is required. Do not change it.
                namespace NinjaTrader.Indicator
                {
                /// <summary>
                /// Aussie Dollar Index
                /// </summary>
                [Description("Aussie Dollar Index")]
                public class aAUDIndex : 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(Color.Orange, PlotStyle.Line, "Op"));
                Add(new Plot(Color.Orange, PlotStyle.Line, "Hi"));
                Add(new Plot(Color.Orange, PlotStyle.Line, "Lo"));
                Add(new Plot(Color.Orange, PlotStyle.Line, "Cl"));

                Add("GOOG",PeriodType.Day,1);
                Add("AAPL",PeriodType.Day,1);
                Overlay = false;
                }

                /// <summary>
                /// Called on each bar update event (incoming tick)
                /// </summary>
                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.
                Op.Set(Opens[1][0] - Opens[2][0]);
                Hi.Set(Highs[1][0]-Highs[2][0]);
                Lo.Set(Lows[1][0]-Lows[2][0]);
                Cl.Set(Closes[1][0]-Closes[2][0]);

                }

                #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 Op
                {
                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 Hi
                {
                get { return Values[1]; }
                }

                public DataSeries Lo
                {
                get { return Values[2]; }
                }

                [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 Cl
                {
                get { return Values[3]; }
                }

                [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 aAUDIndex[] cacheaAUDIndex = null;

                private static aAUDIndex checkaAUDIndex = new aAUDIndex();

                /// <summary>
                /// Aussie Dollar Index
                /// </summary>
                /// <returns></returns>
                public aAUDIndex aAUDIndex(int myInput0)
                {
                return aAUDIndex(Input, myInput0);
                }

                /// <summary>
                /// Aussie Dollar Index
                /// </summary>
                /// <returns></returns>
                public aAUDIndex aAUDIndex(Data.IDataSeries input, int myInput0)
                {
                if (cacheaAUDIndex != null)
                for (int idx = 0; idx < cacheaAUDIndex.Length; idx++)
                if (cacheaAUDIndex[idx].MyInput0 == myInput0 && cacheaAUDIndex[idx].EqualsInput(input))
                return cacheaAUDIndex[idx];

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

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

                aAUDIndex indicator = new aAUDIndex();
                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();

                aAUDIndex[] tmp = new aAUDIndex[cacheaAUDIndex == null ? 1 : cacheaAUDIndex.Length + 1];
                if (cacheaAUDIndex != null)
                cacheaAUDIndex.CopyTo(tmp, 0);
                tmp[tmp.Length - 1] = indicator;
                cacheaAUDIndex = 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>
                /// Aussie Dollar Index
                /// </summary>
                /// <returns></returns>
                [Gui.Design.WizardCondition("Indicator")]
                public Indicator.aAUDIndex aAUDIndex(int myInput0)
                {
                return _indicator.aAUDIndex(Input, myInput0);
                }

                /// <summary>
                /// Aussie Dollar Index
                /// </summary>
                /// <returns></returns>
                public Indicator.aAUDIndex aAUDIndex(Data.IDataSeries input, int myInput0)
                {
                return _indicator.aAUDIndex(input, myInput0);
                }
                }
                }

                // This namespace holds all strategies and is required. Do not change it.
                namespace NinjaTrader.Strategy
                {
                public partial class Strategy : StrategyBase
                {
                /// <summary>
                /// Aussie Dollar Index
                /// </summary>
                /// <returns></returns>
                [Gui.Design.WizardCondition("Indicator")]
                public Indicator.aAUDIndex aAUDIndex(int myInput0)
                {
                return _indicator.aAUDIndex(Input, myInput0);
                }

                /// <summary>
                /// Aussie Dollar Index
                /// </summary>
                /// <returns></returns>
                public Indicator.aAUDIndex aAUDIndex(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.aAUDIndex(input, myInput0);
                }
                }
                }
                #endregion

                Comment


                  #9
                  Ok, I see what you mean.

                  The Plots are bit limited that you can only use a line. If you want a custom bar plotted, it will take some pretty serious programming to accomplish this.

                  However there are already a few indicators which accomplish this. Please take a look at the following and see if it does exactly what you're looking for:



                  If you're feeling ambitious, you may take some of the concepts in this indicator and apply them to your own custom, however we do not have documentation for creating the custom bars as you see here.
                  MatthewNinjaTrader Product Management

                  Comment

                  Latest Posts

                  Collapse

                  Topics Statistics Last Post
                  Started by JonesJoker, 04-22-2024, 12:23 PM
                  9 responses
                  46 views
                  0 likes
                  Last Post NinjaTrader_ChelseaB  
                  Started by timko, Today, 06:45 AM
                  1 response
                  7 views
                  0 likes
                  Last Post gaz0001
                  by gaz0001
                   
                  Started by Waxavi, 04-19-2024, 02:10 AM
                  3 responses
                  41 views
                  0 likes
                  Last Post gaz0001
                  by gaz0001
                   
                  Started by Max238, Today, 01:28 AM
                  2 responses
                  26 views
                  0 likes
                  Last Post NinjaTrader_ChristopherJ  
                  Started by Shansen, 08-30-2019, 10:18 PM
                  25 responses
                  949 views
                  0 likes
                  Last Post NinjaTrader_BrandonH  
                  Working...
                  X