Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Closes[1]

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

    Closes[1]

    OK, in NT7 the original chart is Closes[0], BarsArray[0], BarsInProgress[0], etc.
    A second data stream can be Added in the Initialize method of an Indicator and this becomes Closes[1], BarsArray[1], BarsInProgress[1], etc

    What about Highs[1], Lows[1] -- they are not mentioned in the NT7 help file?

    The v6 help says to use BarsArray[1] as the input series to a called indicator...
    Logically, in NT7, this should be Closes[1] or Highs[1], Lows[1] depending on what is wanted; however, the NT7 does not say this.

    If this is true, please confirm and update the help file for NT7. Thanks!

    #2
    LostTrader, I'm not sure which info you believe is missing - http://www.ninjatrader.com/support/h.../nt7/highs.htm

    You can just pass in BarsArray[x] (close of the added object), or be more explicit with Lows[x], Highs[x] etc.

    Comment


      #3
      cannot use second data stream w/o error

      Thank you, Bertrand. Apparently it is an issue of me not navigating the NT7 help accurately.

      Unfortunately, it is not working for me no matter which Input Series is used.

      I boiled it down to a simple test (attached below).
      A second data stream is added in Initialize() = same instrument, relative fractal.
      Add(BarsPeriod.Id, BarsPeriod.Value*2);

      If the integer input = 0, it works. If x=1, it fails. But I do not understand why.
      Code:
      if (BarsInProgress != x) return; 
                  
                  if (CurrentBars[x] < 6)
                      Value.Set(Inputs[x][0]);
                  else
                  {    
                      Value.Set( WMA( Inputs[x], 5 )[0] );
                  }
      Attached Files

      Comment


        #4
        Works for me if I just comment out your first BIP check - you point to a specific bars array to use already with your Inputs call.

        Comment


          #5
          Originally posted by NinjaTrader_Bertrand View Post
          Works for me if I just comment out your first BIP check - you point to a specific bars array to use already with your Inputs call.
          No. If I comment out
          Code:
          if (BarsInProgress != x) return;
          then it fails with either x=0 or x=1 !!!!

          Comment


            #6
            What do you exactly mean with it fails? Are you getting any log errors or are you seeing just unexpected results? Please see my attached shot from ES 2 min, orange X = 1, red X =2 - both timeframes WMA showing as expected.
            Attached Files

            Comment


              #7
              As (originally) uploaded x=1 produces:
              Error on calling 'OnBarUpdate' method for indicator 'Test' on bar 0: You are accessing an index with a value that is invalid since its out of range. I.E. accessing a series [barsAgo] with a value of 5 when there are only 4 bars on the chart.
              If the BIP line is commented out, BOTH x=0 and x=1 will produce the same error message above

              Now, admittedly, my test is on volume bars...
              Attached Files

              Comment


                #8
                After looking at the Correlations indicator code, I updated this line
                Code:
                 set { if (ChartControl != null) x = Math.Max(0, Math.Min(ChartControl.BarsArray.Length-1, value)); else x=0; }
                to limit the input to the correct number of BarsArrays -- but this will not allow x=1 even though a second Bar series is added in Initialize().

                It causes the error
                Failed to set property 'X' for indicator 'Test': Exception has been thrown by the target of an invocation.
                Why? Shouldn't it work?
                Attached Files

                Comment


                  #9
                  You hardcoded the input then to be 0 all the time, thus it would not show any WMA based on the added series, if I manually direct the WMA to Inputs[1] it plots with no issues here.

                  Comment


                    #10
                    The x=0 result is ONLY if ChartControl== null.
                    Are you telling me that ChartControl is ALWAYS null?

                    Comment


                      #11
                      CL Test

                      And this VERY CLEARLY DOES NOT WORK !

                      If you are changing something to make it work, kindly upload what you changed. Your ES image certainly was not taken from the indicator as is because it does not overlay on price unless you CHANGE something.
                      Attached Files

                      Comment


                        #12
                        The ES chart contained exactly your indicator, you can just overaly with a mouseclick which I did to simplify visualization - for the error you posted (which I unfortunately can't reproduce here at this time on my B19), please try adding this check for the 2 bars objects you use at the OnBarUpdate() start -

                        Code:
                         
                        if (CurrentBars[0] < 0 || CurrentBars[1] < 0) return;

                        Comment


                          #13
                          Y'all have some serious bugs in this area.

                          Adding that did prevent the exception -- which makes no logical sense. But the resulting plots are no good. And Bertrand, this MUST work in its own panel.

                          See the pics below. Even if the line is disconnected (which a line should NOT be), it should exist on every other bar since the internal bar series is 2x the chart value of the underlying.

                          Now that you have Initialize() & OnStartUp(), why would NT ever call OnBarUpdate() when there is no Bar? This in and of itself it a bug [aka design flaw] in NT.
                          Attached Files
                          Last edited by Lost Trader; 07-28-2010, 09:48 AM.

                          Comment


                            #14
                            FYI, re-structuring the "if (BarsInProgress != x) return; "
                            into "if (BarsInProgress == x) {}" to encapsulate the remaining code has mixed results.

                            on a minute chart: there is no exception but the plot is incomplete.

                            on a volume chart: it still throws the same exception, and not on bar 0 either, always on bar 5.

                            Please start testing something other than time charts....

                            Comment


                              #15
                              LostTrader, can you please attach the latest code you're now using after those changes - moving the indicator to another panel has no bearing on the internal workings / calcs, I was just doing it for visualization purposes to show you - with the code you provided so far I can unfortunately no reproduce an exception here, are you sure you're on our latest NT7 Beta 19?

                              Thanks

                              Comment

                              Latest Posts

                              Collapse

                              Topics Statistics Last Post
                              Started by Geovanny Suaza, 02-11-2026, 06:32 PM
                              0 responses
                              602 views
                              0 likes
                              Last Post Geovanny Suaza  
                              Started by Geovanny Suaza, 02-11-2026, 05:51 PM
                              0 responses
                              347 views
                              1 like
                              Last Post Geovanny Suaza  
                              Started by Mindset, 02-09-2026, 11:44 AM
                              0 responses
                              103 views
                              0 likes
                              Last Post Mindset
                              by Mindset
                               
                              Started by Geovanny Suaza, 02-02-2026, 12:30 PM
                              0 responses
                              559 views
                              1 like
                              Last Post Geovanny Suaza  
                              Started by RFrosty, 01-28-2026, 06:49 PM
                              0 responses
                              558 views
                              1 like
                              Last Post RFrosty
                              by RFrosty
                               
                              Working...
                              X