Announcement

Collapse

Looking for a User App or Add-On built by the NinjaTrader community?

Visit NinjaTrader EcoSystem and our free User App Share!

Have a question for the NinjaScript developer community? Open a new thread in our NinjaScript File Sharing Discussion Forum!
See more
See less

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 Aviram Y, Today, 05:29 AM
              0 responses
              1 view
              0 likes
              Last Post Aviram Y  
              Started by quantismo, 04-17-2024, 05:13 PM
              3 responses
              25 views
              0 likes
              Last Post NinjaTrader_Gaby  
              Started by ScottWalsh, 04-16-2024, 04:29 PM
              7 responses
              34 views
              0 likes
              Last Post NinjaTrader_Gaby  
              Started by cls71, Today, 04:45 AM
              0 responses
              6 views
              0 likes
              Last Post cls71
              by cls71
               
              Started by mjairg, 07-20-2023, 11:57 PM
              3 responses
              216 views
              1 like
              Last Post PaulMohn  
              Working...
              X