Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Referencing 2nd DataSeries in NT7

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

    Referencing 2nd DataSeries in NT7

    I am trying to reference the 2nd dataseries one bar back and if condition is true, plot on 1st dataseries. Where am I going wrong?

    if
    ( CurrentBar <1) return;

    if (Closes[1][1] >= Opens[1][1]) // second dataseries one bar back ?
    {
    DrawDot("MyDotbuy"+CurrentBar, true, 0, Lows[0][0] - (2 * TickSize), Color.Blue);
    }


    Thanks

    #2
    Hello Velocity,

    You most likely need the Current Bar check on the secondary series.
    This is accessed with CurrentBars.

    if (CurrentBars[1] < 1)
    return;

    Ryan M.NinjaTrader Customer Service

    Comment


      #3
      I change the code as you suggested with the following, but no luck.

      if( CurrentBars[0] <1) return; // 1st DataSeries
      if( CurrentBars[1] <1) return; // 2nd DataSeries

      if (Closes[1][1] >= Opens[1][1]) // second dataseries one bar back ?
      {
      DrawDot("MyDotbuy"+CurrentBar, true, 0, Lows[0][0] - (2 * TickSize), Color.Blue);
      }

      Any thoughts as to where I am going wrong.

      thanks.

      Comment


        #4
        Hi Velocity,

        Can you let us know the primary and secondary series intervals you're using? I'll try to set it up here to see what might need to be changed.
        Ryan M.NinjaTrader Customer Service

        Comment


          #5
          15 minute on both DataSeries

          Comment


            #6
            It's working OK here - applied to MSFT with second series AAPL added. Below is what I'm using:

            Code:
             
            protected override void Initialize()
            {
            Overlay = true;
            Add("AAPL", PeriodType.Minute, 15, MarketDataType.Last);
            }
            /// <summary>
            /// Called on each bar update event (incoming tick)
            /// </summary>
            protected override void OnBarUpdate()
            {
            
            if( CurrentBars[0] <1) return; // 1st DataSeries
            if( CurrentBars[1] <1) return; // 2nd DataSeries
            if (Closes[1][1] >= Opens[1][1]) // second dataseries one bar back ?
            {
            DrawDot("MyDotbuy"+CurrentBar, true, 0, Lows[0][0] - (2 * TickSize), Color.Blue);
            }
            }
            If you are still seeing issues here, can you share the complete code including Initialize() and the instrument you have this applied to?
            Ryan M.NinjaTrader Customer Service

            Comment


              #7
              Have a question for you.

              Do you always have to add the second series?

              Add("AAPL", PeriodType.Minute, 15, MarketDataType.Last);

              Or, does NT7 automatically recognize the order of the data?

              Thanks

              Comment


                #8
                Yes, you have to add a second series in the code. Otherwise there are no bars loaded when accessing Closes[1][1].
                Ryan M.NinjaTrader Customer Service

                Comment

                Latest Posts

                Collapse

                Topics Statistics Last Post
                Started by XXtrader, Yesterday, 11:30 PM
                2 responses
                11 views
                0 likes
                Last Post XXtrader  
                Started by Waxavi, Today, 02:10 AM
                0 responses
                6 views
                0 likes
                Last Post Waxavi
                by Waxavi
                 
                Started by TradeForge, Today, 02:09 AM
                0 responses
                11 views
                0 likes
                Last Post TradeForge  
                Started by Waxavi, Today, 02:00 AM
                0 responses
                2 views
                0 likes
                Last Post Waxavi
                by Waxavi
                 
                Started by elirion, Today, 01:36 AM
                0 responses
                7 views
                0 likes
                Last Post elirion
                by elirion
                 
                Working...
                X