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

Multi Series Programming

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

    Multi Series Programming

    Hi,

    Is there a way to programatically detect how many series are active on a chart, the instruments and their times and types? For example, suppose I create a chart with 5 min ES candlestick chart (primary series), a 1000V HiLo bar chart of ES, and a 500 Tick Box chart of NQ. Can I retieve this info programatically? Thanks for any suggestions.

    #2
    Hello Zeos6,
    Yes, you can do so using the unsupported ChartControl class.

    Code:
    ChartControl.BarsArray[0];  //returns the primary series
    ChartControl.BarsArray[1];  //returns the secondary series
    Unfortunately the ChartControl class is not officially supported and thus not documented.
    JoydeepNinjaTrader Customer Service

    Comment


      #3
      Hi Joydeep,

      Thank you. I am aware of those ChartControl objects. It provides more info than I need, but the chart type has to be obtained separately. I simply thought there might be a cleaner way to get this info.

      However, is there any way to determine how many data series are present?

      Thank you.

      Comment


        #4
        Hello Zeos6,
        The below code will let you know the periodicity value of the chart
        Code:
        ChartControl.BarsArray[0].Period.Id 
        ChartControl.BarsArray[0].Period.Value


        ChartControl.BarsArray.Count will return you the total number of bar series.
        JoydeepNinjaTrader Customer Service

        Comment


          #5
          Fantastic! That is exactly what I was looking for. Thank you very much. It is appreciated.

          Comment


            #6
            One more quickie, please. Is there a way to determine the chart style of each of those series? Thank you.

            Comment


              #7
              Hello Zeos6,
              Please use the below code to determine the chart style
              Code:
              ChartControl.BarsArray[0].BarsData.ChartStyle
              JoydeepNinjaTrader Customer Service

              Comment


                #8
                Once again, thank youi very much. Much appreciated.

                Comment


                  #9
                  Originally posted by Zeos6 View Post
                  One more quickie, please. Is there a way to determine the chart style of each of those series? Thank you.
                  ChartControl.ChartStyleType.ToString();

                  Comment


                    #10
                    Hi koganam,

                    Thank you. I am aware of that code but that works only for the case of a single data series. I was looking to identify the style of each data series in a multi data series chart.

                    Comment


                      #11
                      Hi Joydeep,

                      One additional issue came up for me. When you have a multi data series chart and add an indicator, say an EMA, you can add the indicator for each of the data series in the chart - there is an Input Data Series option in the indicator parameters.

                      1. Is there a way to create an Input Data Series input variable parameter for use in custom code so that the code will only run on that data series in a multi data series environment?

                      2. Give a data series in a multi data seies chart, is there a way to determine its BarrsArray[Index] value?

                      Any help would be greatly appreciated. Thank you.

                      Comment


                        #12
                        Hello Zeos6,
                        1. You may try creating custom typeconverter however however I am not sure whether the indicator will work correctly with reference to the bars array other that the input series.

                        2. Can you please further clarify your query.
                        JoydeepNinjaTrader Customer Service

                        Comment


                          #13
                          Hi Joydeep,

                          The issue is as follows:
                          Some of the indicators, for example EMA, allow you to specify the input series to be used with that indicator. How can I specify the input series to be used with a custom indicator and get the BarsArray index of that input series for use in a multi data series/mullti instrument chart?

                          Based on the EMA code it would appear that the Input series input indicator parameter is linked to the Value data series objects. Is that correct?

                          Comment


                            #14
                            Hello Zeos6,
                            Yes, the input series is linked to the indicator parameters box by default.

                            You have to simply compare the bar periodicity/value and check it. I am not aware of any native property which returns the bar index value.
                            JoydeepNinjaTrader Customer Service

                            Comment


                              #15
                              Thank you for the clarfication. Will work on this. Is there a way to determine what the Input series is stored as internally so that I can compare it to BarsArray[index]?

                              Comment

                              Latest Posts

                              Collapse

                              Topics Statistics Last Post
                              Started by helpwanted, Today, 03:06 AM
                              1 response
                              16 views
                              0 likes
                              Last Post sarafuenonly123  
                              Started by Brevo, Today, 01:45 AM
                              0 responses
                              11 views
                              0 likes
                              Last Post Brevo
                              by Brevo
                               
                              Started by aussugardefender, Today, 01:07 AM
                              0 responses
                              6 views
                              0 likes
                              Last Post aussugardefender  
                              Started by pvincent, 06-23-2022, 12:53 PM
                              14 responses
                              244 views
                              0 likes
                              Last Post Nyman
                              by Nyman
                               
                              Started by TraderG23, 12-08-2023, 07:56 AM
                              9 responses
                              387 views
                              1 like
                              Last Post Gavini
                              by Gavini
                               
                              Working...
                              X