Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Equidistant spacing in multi-dataseries-charts

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

    Equidistant spacing in multi-dataseries-charts

    I want to plot indicators based on data series that are not time-based, like Renko or Range, on a chart with a primary data series that may or may not be time-based. I know how to hide the non-primary data series and I also know that NT does not provide a genuine solution for making the bars equidistant in this situation. Does anyone know about a - possibly unsupported - workaround for this?

    #2
    Hello,

    Thank you for the question.

    Using the User interface, there is not really a way around the Equidistant spacing and how Time and Non Time based charts are displayed.

    Using NinjaScript, you could create a indicator for example that is displayed on a Time chart but uses Tick data for calculations or plotting. In the case of adding a series using NinjaScript, that series is not actually added for display on the chart so it would not affect the primary Equidistant bar spacing.

    I look forward to being of further assistance.
    JesseNinjaTrader Customer Service

    Comment


      #3
      Thanks for your reply. So if, for instance, I want to overlay a renko indicator on a range chart, I would create an indicator where the renko dataseries is added with "new DataSeries()" inside the Initialize() method. Is that what you mean? What would be the correct syntax for the creation of the dataseries object? I couldn't find that in the documentation.

      Comment


        #4
        Hello,

        For Renko specifically, there is a method for that. Other series like Minute or Tick would utilize the Add() method.

        Here is the documentation on AddRenko: http://ninjatrader.com/support/helpG...htsub=addrenko

        This would add the underlying dataseries but would not plot that series, so in turn your script can use both series but only plot the main series.

        I look forward to being of further assistance.
        JesseNinjaTrader Customer Service

        Comment


          #5
          I understand how to add a dataseries to the indicator, but I don't know how to assign the dataseries to a variable that I can use to access the data. Usually there is something like

          value = new DataSeries(this);

          but how does that work if I add the dataseries through something like AddRenko()?

          Comment


            #6
            Hello,

            I will provide some links below that will help clear up any confusions with Multiple series, essentially the items you would need to access the values would be as follows:


            Code:
            protected override void Initialize()
            {
                    AddRenko(Instrument.FullName, 3, MarketDataType.Last);
            }
            		
            protected override void OnBarUpdate()
            {
            	if(BarsInProgress == 0)
            	{
            		//main series called OnBarUpdate
            		if(CurrentBars[1] > 0)
            		{
            			//renko has at least 1 bar
            			Print(Closes[1][0]);
            			//print the Close price of the Renko's current bar
            		}
            	} 
            	else if(BarsInProgress == 1)
            	{
            		//renko called OnBarUpdate	
            	}
            }

            This would simply Add a renko series.
            In OnBarUpdate an if statement is used to determine which series called OnBarUpdate.
            If the Primary series or chart series called OnBarUpdate, the value of the Renko's currentBar is printed.

            Closes[DataSeriesIndex][BarsAgo] is being used or Closes[1][0], this is saying to get the Close price from Index 1 or the 1st added series or Renko in this case and get the value of 0 bars ago from that series.

            This would not affect the charts display but you would have access to the underlying data.

            DataSeries = new DataSeries(this) is a similar concept, except this would be for storing your own data rather than NinjaTrader using Historical/live market data as a underlying series.

            For a better explaination of how OnBarUpdate is being called in this case, please see these links:



            I look forward to being of further assistance.
            JesseNinjaTrader Customer Service

            Comment


              #7
              Thanks for your help. Although I believe I understand what you're saying, it still doesn't work. Is there there a coding example for an indicator running on an added DataSeries somewhere in the Support Forum?

              Comment


                #8
                Hello,

                Thank you for the reply.

                Can you please tell me what portion of this you were unable to get working?

                This is for/from an indicator so this would be an example for an indicator using multiple series which is what you had asked. the DataSeries in this example for the Renko is the " Closes[1][0] ".

                Can you confirm what problem you ran into and I could provide details.

                I look forward to being of further assistance.
                JesseNinjaTrader Customer Service

                Comment

                Latest Posts

                Collapse

                Topics Statistics Last Post
                Started by bortz, 11-06-2023, 08:04 AM
                47 responses
                1,607 views
                0 likes
                Last Post aligator  
                Started by jaybedreamin, Today, 05:56 PM
                0 responses
                9 views
                0 likes
                Last Post jaybedreamin  
                Started by DJ888, 04-16-2024, 06:09 PM
                6 responses
                19 views
                0 likes
                Last Post DJ888
                by DJ888
                 
                Started by Jon17, Today, 04:33 PM
                0 responses
                6 views
                0 likes
                Last Post Jon17
                by Jon17
                 
                Started by Javierw.ok, Today, 04:12 PM
                0 responses
                15 views
                0 likes
                Last Post Javierw.ok  
                Working...
                X