Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

AddDataSeries() with "Equidistant bar spacing" feature

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

    AddDataSeries() with "Equidistant bar spacing" feature

    Hey guys,

    When you manually add a secondary data series to a chart, the "Equidistant Bar Spacing" ChartControl option becomes active.
    When you add by code, nothing happens.
    Is there a way to enable this feature when using "AddDataSeries()"?
    Or, better, enable it through code without using "AddDataSeries()"?

    Thanks​

    #2
    That is not what AddDataSeries does. It does not add anything to the chart, so the chart's properties would be unaffected. The purpose of AddDataSeries is to create a series IN MEMORY for you to use in your analysis behind the scenes. So, for instance, if you have a Renko bar chart, you can still display the value of a 50-day SMA if you want, by adding that daily bar data series with AddDataSeries. It does not have to display the daily bars, and in fact, that would generally make it less useful (often we want to do analysis of a dozen or more series and we don't want to see all those bars cluttering up the screen and distorting the scale) - if you want to show the daily bars just add them to the chart.
    Bruce DeVault
    QuantKey Trading Vendor Services
    NinjaTrader Ecosystem Vendor - QuantKey

    Comment


      #3
      Hey QuantKey_Bruce,

      You did not got the idea.
      The idea is not to show the secondary data series added via the indicator, but to give the chart where you added the indicator the "Equidistant Bar Spacing" feature because with that you can manipulate things using time.​

      Tick Chart + Minute Chart (manually added):

      Click image for larger version

Name:	2023-06-27 090008.png
Views:	138
Size:	29.9 KB
ID:	1257730

      Comment


        #4
        Hello rafaelcoisa,

        Unfortunately, AddDataSeries() cannot add a series to the chart. The series is used only internally by the script and does not display on the chart.
        Chelsea B.NinjaTrader Customer Service

        Comment


          #5
          Thanks NinjaTrader_ChelseaB for the answer.
          I suspected that wouldn't be possible.
          Another thing. I'm drawing vertical lines using "DateTime" on charts without time.
          Is there anything I can do to get the "Crosshair" to show the correct values on the timescale (when i put the mouse over the line​)?
          The drawing tools window shows the correct value of the lines.

          Comment


            #6
            Hello rafaelcoisa,

            The databox will only be showing plots from indicators as well as the data series bar information.

            If the value is a double, assign the value to a plot to see this in the databox.

            A vertical line only has a time property.

            To confirm, you are wanting to get the time value of the anchor of a vertical line?
            Chelsea B.NinjaTrader Customer Service

            Comment


              #7
              Hey NinjaTrader_ChelseaB,

              I'm currently dealing with this problem:

              Click image for larger version

Name:	dateTimeTickChart.gif
Views:	161
Size:	976.8 KB
ID:	1257782

              The "Crosshair" on the "TickChart" does not show the correct time value on the timescale, even though the value is correct as shown in the "DrawingTool" window and when I manually add a secondary data series (the "Crosshair" here shows the correct value time in the time scale).
              So I'm trying to get the "Crosshair" on the "TickChart" to show the correct time value on the timescale.
              It's possible?​

              Comment


                #8
                Hello rafaelcoisa,

                Does this chart have multiple series added?

                Are you drawing the line using a BarsAgo value with Draw.VerticalLine() or are you using a specific date and time?
                Chelsea B.NinjaTrader Customer Service

                Comment


                  #9
                  I'm using this to draw the lines:
                  Code:
                  Draw.VerticalLine(NinjaScriptBase owner, tag string, DateTime time, Brush brush)
                  There are two charts.
                  One, it only has 2000 ticks.
                  The other has 2000 ticks and 2 minutes.
                  The two with the same indicator that don't have AddDataSeries().​

                  Comment


                    #10
                    Hello rafaelcoisa,

                    Likely you are using a datetime that is not the exact time of the close of a bar.

                    Trying use a barsAgo value instead of a datetime.

                    Draw.VerticalLine(NinjaScriptBase owner, string tag, int barsAgo, Brush brush)
                    Chelsea B.NinjaTrader Customer Service

                    Comment


                      #11
                      Hey NinjaTrader_ChelseaB,

                      So, is it impossible to show on the timescale of a TickChart something other than the closing time of the bars? Right?​

                      Comment


                        #12
                        Hello rafaelcoisa,

                        If a drawing object is not drawn at the close of a bar, then it will be between bar close times and will be rendered somewhere off center of the bar.

                        You could supply the time of a previously closed bar, Time[0], and this would be at the bar close time. But in real-time you would need to predict the future and know exactly what time the non-time-based bar will close which wouldn't be possible.
                        Chelsea B.NinjaTrader Customer Service

                        Comment


                          #13
                          No, NinjaTrader_ChelseaB.
                          I don't want to predict the future.
                          I want to show the time value of a historical vertical line that is not the value of any close time of any bar on the timescale when I use the crosshair. Just that.
                          It's possible?​

                          Comment


                            #14
                            Hello rafaelcoisa,

                            That appears to be what your chart is showing. Lines drawn at different times than the close of a bar. The line is showing between bars because the time is between bars.
                            If you want the line to appear in the center of the bar, then it needs the same time as the close of the bar.
                            Its being displayed where you have designated it to be displayed.
                            Chelsea B.NinjaTrader Customer Service

                            Comment


                              #15
                              NinjaTrader_ChelseaB
                              I'm talking about the value that appears in the crosshair.
                              The value is wrong despite the fact that the line has been rendered in the correct place.
                              So again, is there any way to show the correct value in the crosshair?

                              Comment

                              Latest Posts

                              Collapse

                              Topics Statistics Last Post
                              Started by Geovanny Suaza, 02-11-2026, 06:32 PM
                              0 responses
                              576 views
                              0 likes
                              Last Post Geovanny Suaza  
                              Started by Geovanny Suaza, 02-11-2026, 05:51 PM
                              0 responses
                              334 views
                              1 like
                              Last Post Geovanny Suaza  
                              Started by Mindset, 02-09-2026, 11:44 AM
                              0 responses
                              101 views
                              0 likes
                              Last Post Mindset
                              by Mindset
                               
                              Started by Geovanny Suaza, 02-02-2026, 12:30 PM
                              0 responses
                              553 views
                              1 like
                              Last Post Geovanny Suaza  
                              Started by RFrosty, 01-28-2026, 06:49 PM
                              0 responses
                              551 views
                              1 like
                              Last Post RFrosty
                              by RFrosty
                               
                              Working...
                              X