• If this is your first visit, you will have to register before you can post. To view messages, please scroll below and select the forum that you would like to visits. Questions? Be sure to check out the Forum FAQ.

Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Indicator on Multiple Instruments

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

    Indicator on Multiple Instruments

    HI,

    Suppose I create a chart with multiple instruments. Furthermore, suppose I create this chart through Data Series rather than programatically via Add(). If I have a custom indicator that say simply plots 2*Close[0], I can use this indicator on each of the instruments on the chart.

    Here is the issue: How does the indicator know which instrument data series to use? I realize that part of the information comes from the input series. So if I specify the Input series as the correct instrument but say I specify it as the Low of that instrument, my indicator will still work correctly even though it is simply referencing the Close. I am assuming here that in this instance the Close is simply being replaced by some version of Bars.GetClose(lastBar).

    I realize this is likely unsupported but can anyone please shed some light on how NT determines from the input series specified which series close the Close[0] refers to? I would be very appreciative. Thank you.

    #2
    Hello Zeos6,
    You can use the below unsupported code to get the bar series as applied on the chart
    Code:
    ChartControl.BarsArray[0]
    ChartControl.BarsArray[1]
    The ChartControl class is not officially supported and thus not documented.
    JoydeepNinjaTrader Customer Service

    Comment


      #3
      Thank you for your reply, but you are not answering the question. I know I can use ChartControl.BarsArray[index]. The issue is that when I use Close[0] how does it get the index from the Input series?

      Comment


        #4
        Hello Zeos6,
        Close[0] will specifically refer to the primary bar only.
        JoydeepNinjaTrader Customer Service

        Comment


          #5
          I believe I have found the answer. The index comes from BarsInProgress of the Input Series. Can you please confirm this? Thanks.

          Comment


            #6
            Hello Zeos6,
            BarsInProgress will referenced only if you add the secondary bar series via the Add() method.
            JoydeepNinjaTrader Customer Service

            Comment


              #7
              Then how does it get the index reference? The fact is that it works. So please explain. Thanks.

              Comment


                #8
                Hello Zeos6,
                If you simply try the below code then are you able to determine the bar

                Code:
                foreach (Bars bar in ChartControl.BarsArray)
                {
                	if (bar == Bars)
                	{
                		//do something
                	}
                }
                JoydeepNinjaTrader Customer Service

                Comment


                  #9
                  This does work, thank you very much. Not sure, however, how to use this to extract the index for use with BarsArray[index].

                  Comment


                    #10
                    Hello Zeos6,
                    The BarsInProgess property is not available in the Bars class. It is available in the Indicators and strategies class only.

                    The best you can do is to find the panel information using the below unsupported code.

                    Code:
                    ChartControl.BarsArray[0].BarsData.Panel
                    JoydeepNinjaTrader Customer Service

                    Comment


                      #11
                      Hi Joydeep,

                      This simply returns an integer - 0 in my case. What specific information is provided by

                      ChartControl.BarsArray[0].BarsData.Panel

                      Also, what specific information is returned by

                      ChartControl.BarsArray[0].BarsData.PanelUI

                      Thanks.

                      Comment


                        #12
                        Hello Zeos6,
                        ChartControl.BarsArray[0].BarsData.Panel will simply return the panel number infor.

                        For example if you set the chart as the attached screenshot then it (ChartControl.BarsArray[0].BarsData.Panel) will return 1.

                        Unfortunately thee ChartControl Class is not officially supported by us and thus its properties are not documented.
                        Attached Files
                        JoydeepNinjaTrader Customer Service

                        Comment


                          #13
                          Thank you Joydeep. I realize that ChartControl is unsupported and I am thank ful that you are willing to answer a few questions about it. Can you please let me know what information the

                          ChartControl.BarsArray[0].BarsData.PanelUI

                          provides? Thank you very much.

                          Comment


                            #14
                            Hello Zeos6,
                            PanelUI is the panel number where the Data Series will be plotted. Seems it is the exposed member (and non zero based).
                            JoydeepNinjaTrader Customer Service

                            Comment


                              #15
                              Thank you very much.

                              Comment

                              Latest Posts

                              Collapse

                              Topics Statistics Last Post
                              Started by CoffeeOutlaw, Today, 05:59 PM
                              3 responses
                              12 views
                              0 likes
                              Last Post CoffeeOutlaw  
                              Started by Da vinci, Today, 04:19 PM
                              2 responses
                              11 views
                              0 likes
                              Last Post Da vinci  
                              Started by brunoviveiros, Today, 09:36 AM
                              1 response
                              24 views
                              0 likes
                              Last Post NinjaTrader_BrandonH  
                              Started by GARZONJ, Today, 11:22 AM
                              1 response
                              10 views
                              0 likes
                              Last Post NinjaTrader_Jesse  
                              Started by KonalGondal, Today, 10:18 AM
                              1 response
                              20 views
                              0 likes
                              Last Post NinjaTrader_Kate  
                              Working...
                              X