Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Multiple Instruments/Multiple Data Series Issue

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

    Multiple Instruments/Multiple Data Series Issue

    Hi,

    I understand that NinjaScript will only look at the Input Data Series that is passed to it regardless of how many Data Series are applied to a chart. If you have a chart with a ES 12-12 1 Min, NQ 12-12 1 Min, and ES 12-12 60 Min Data Series on it and you use the Input Data Series as the ES 12-12 1 Min the BarsInProgress would be:

    * BarsInProgress index 0 would be the Input Data Series or in this Case the ES 12-12 1 Min
    * BarsInProgress index 1 would be the first Add() method which is the ES 12-12 5 Min
    * BarsInProgress index 2 would be the next Add() method which is the NQ 12-12 100Tick

    I have two questions:

    1. Clearly ES 12-12 is the primary series here. However, suppose that the Input Data Series tot he indicator was ES 12-12 60 min. Would the BarsInProgress index still be 0 or would it now be 2?

    2. Is there a way to determine what index the Input Data Series is being assigned?

    Thank you for any suggestions.

    #2
    Hello Zeos6,

    Thank you for your note.

    BarsInProgress Index for the primary data series will always be 0, regardless of the period type used for the primary data series.

    If you are adding additional data series then each one will be assigned their BarsInProgess Index in the order they are added.

    For example:
    Add(PeriodType.Minute, 5); // This would be BarsInProgress Index 1
    Add(PeriodType.Minute, 10); // This would be BarsInProgress Index 2
    Add(PeriodType.Minute, 15); // This would be BarsInProgress Index 3

    Please let me know if I may be of further assistance.

    Comment


      #3
      Thank you for your reply PatrickH. But you are not answering my questions.

      From your reply I gather that the index of the BarsInProgress is the same as the BarsArray[index], and is simply based on the primary series and the order sequence of the series added. Is that correct?

      Also, please answer my question 2.

      Thank you.

      Comment


        #4
        Hello Zeos6,

        Thank you for your response.

        From your reply I gather that the index of the BarsInProgress is the same as the BarsArray[index], and is simply based on the primary series and the order sequence of the series added. Is that correct?
        That is correct, the order they are added in is the sequence the BarsInProgress Index takes.
        Also, please answer my question 2.
        This is answered above. If you are looking at the primary bar series then it is 1, if it is the first one you added then 2, etc.

        I recommend reviewing the material covered in Multiple Instruments and Time Frames at the following link: http://www.ninjatrader.com/support/h...nstruments.htm

        Please let me know if I may be of further assistance.

        Comment


          #5
          Thank you for your reply PatrickH.

          I guess I am not asking the second question correctly. Generally when you have an input parameter to an indicator your script can access that parameter's value from the code. In the case of Input Data Series there is no parameter to access. Yes, there is BarsArray[index] but that requires a value for the index.So what I am really asking is how can I determine from the codde what index an Input Data Series provided by the user at the time they create a new indicator has been assigned by NT.

          So if I have three series, ES, NQ and YM on the chart, when the user creates a new indicator on the chart he can specify any one of the three series as the input series for the indicator. How does NT match the user's input series with the appropriate BarsArray index of the series?

          Comment


            #6
            Hello Zeos6,

            Thank you for your response.

            This would have to be done by manually adding the instruments to the chart and then selecting the input series from the Indicators parameters when enabling the Indicator. Indicators added manually (let's say by the user) cannot access the BarsInProgress Index of another Indicator or Strategy, meaning any data series or period type added within the code.

            Otherwise to do this within code would not be supported and outside the bounds of NinjaScipt.

            Please let me know if I may be of further assistance.

            Comment


              #7
              Ok Thank you for letting me know.

              Comment

              Latest Posts

              Collapse

              Topics Statistics Last Post
              Started by Geovanny Suaza, 02-11-2026, 06:32 PM
              0 responses
              607 views
              0 likes
              Last Post Geovanny Suaza  
              Started by Geovanny Suaza, 02-11-2026, 05:51 PM
              0 responses
              353 views
              1 like
              Last Post Geovanny Suaza  
              Started by Mindset, 02-09-2026, 11:44 AM
              0 responses
              105 views
              0 likes
              Last Post Mindset
              by Mindset
               
              Started by Geovanny Suaza, 02-02-2026, 12:30 PM
              0 responses
              560 views
              1 like
              Last Post Geovanny Suaza  
              Started by RFrosty, 01-28-2026, 06:49 PM
              0 responses
              561 views
              1 like
              Last Post RFrosty
              by RFrosty
               
              Working...
              X