Announcement
Collapse
No announcement yet.
Partner 728x90
Collapse
NinjaTrader
Equidistant spacing in multi-dataseries-charts
Collapse
X
-
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?Tags: None
-
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
-
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
-
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
-
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
-
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
-
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 Mestor, 03-10-2023, 01:50 AM
|
11 responses
303 views
0 likes
|
Last Post
by z.franck
Today, 02:29 AM
|
||
Started by Padan, Today, 02:02 AM
|
0 responses
6 views
0 likes
|
Last Post
by Padan
Today, 02:02 AM
|
||
Started by bukowa, 11-09-2023, 06:07 PM
|
20 responses
407 views
0 likes
|
Last Post
by Adfra
Today, 01:36 AM
|
||
Started by yertle, Yesterday, 05:49 PM
|
2 responses
11 views
0 likes
|
Last Post
by yertle
Today, 12:12 AM
|
||
Started by kaywai, Today, 12:06 AM
|
0 responses
10 views
0 likes
|
Last Post
by kaywai
Today, 12:06 AM
|
Comment