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!
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
NinjaTrader
Multiple DataSeries
Collapse
X
-
Multiple DataSeries
Hi, I'm using AddVolumetric in my chart, which I think creates a separate data series in my script. I want to plot values on the first data series, based on values of secondary data series. How do I update the Values object this way?Tags: None
-
Hi shildebrand324, thanks for posting.
Please make sure to fully read and understand this page on multi time frame scripts:
https://ninjatrader.com/support/help...venOnbarupdate Method
The section I highlighted shows how to filter the primary and secondary bar series. e.g.in OnBarUpdate
Code:if(BarsInProgress == 0) { //OnBarUpdate called for primary series, fill in Plots here } if(BarsInProgress == 1) { //OnBarUpdate called for secondary series, save values here for use in BIP = 0. }
I also made a related example here:
Kind regards,
-ChrisLAttached FilesChris L.NinjaTrader Customer Service
-
Thanks for the reply. But how do I update the plot values in the main data series, with the values from my volumetric data series? Currently seems like my plots are off by one bar.
Comment
-
Hi, thanks for the follow-up. The multi-time frame guide also covers this topic in this section:
The script will need to run OnPriceChange or OnEachTick in Real Time to get the secondary bars to update in this way.
Also see this example that shows how you can separate OnBarClose logic from OnEachTick logic:
Kind regards,
-ChrisLChris L.NinjaTrader Customer Service
Comment
-
Thanks for the example...I'm still not understanding. I have 3 plots that all need to come from the Volumetric data series, and show those values in plots in the primary data series. Is there an example of that?
Comment
-
Hi, thanks for the follow-up. Unfortunately, we do not have a specific example demonstrating this. I have given all the possible information needed to complete the task. Please make sure to fully read this documentation and test out the behavior on your script after changing the Calculate property to see how it behaves differently.
Kind regards,
-ChrisLChris L.NinjaTrader Customer Service
Comment
-
Hi, I've read and read and read and understand what the articles are saying, but just can't seem to get my marking to show on the correct bar
I've got the following, and when the * marker prints, some of them print off the bars, like it's a bar off. Please help.
else if (State == State.Configure)
{AddVolumetric(null, BarsPeriodType.Tick,BarsPeriod.Value,VolumetricDel taType.BidAsk,1);
}
protected override void OnBarUpdate()
{
if (BarsInProgress == 1) {if (Bars == null)
return;
NinjaTrader.NinjaScript.BarsTypes.VolumetricBarsTy pe barsType = BarsArray[1].BarsSeries.BarsType as
NinjaTrader.NinjaScript.BarsTypes.VolumetricBarsTy pe;
if (barsType == null)
return;try
{Print(Time[0] + " ================================================== =======================");
Print("Maximum Ask: " + barsType.Volumes[CurrentBars[1]].GetMaximumVolume(true, out price) + " at price: " + price);
Print("Maximum Bid: " + barsType.Volumes[CurrentBars[1]].GetMaximumVolume(false, out price) + " at price: " + price);
Print("Maximum Combined: " + barsType.Volumes[CurrentBars[1]].GetMaximumVolume(null, out price) + " at price: " + price);
Text myText = Draw.Text(this, CurrentBars[0].ToString() + @" POC", true,"*", 1, price, 0, Brushes.DarkOrange, font, TextAlignment.Center, Brushes.Transparent, Brushes.Transparent, 0);
myText.IsSeparateZOrder = true;
myText.ZOrder = 1000000;
}
catch{}
}
}
Comment
-
Hi shildebrand324, thanks for the follow up. The secondary series is always processed after the primary series. You should be drawing the dot within the primary series, not in BarsInProgress == 1. What should be done is, save the latest values of the Volumetric bar in BIP =1 and draw the dot in BIP = 0. You can also debug this by using Print to print out the CurrentBars[] value of each series to see why it's printing a bar behind e.g.
Print(CurrentBars[0]);
Print(CurrentBars[1]);
This will let you compare the CurrentBar value and you can see why your script is drawing a bar behind.
Kind regards,
-ChrisLChris L.NinjaTrader Customer Service
Comment
-
Okay, moved the drawing to BarsInProgress == 0 and seems to be a little closer...could there be an issue that I'm using tick charts for primary and volumetric? When I watch in real time live, it seems the POC is good for part of the time, but will fall out of sync near the end of the tick cycle.
CurrentBars[0] seems to always be 1 behind CurrentBars[1]Last edited by shildebrand324; 10-25-2022, 11:38 AM.
Comment
-
Hi shildebrand324, thanks for the follow up.
It depends on what bar series you are using for the primary and secondary series. If the Tick bars are the same value then they will line up together but if there are different Tick bars then they will have different timestamps, so you will get unexpected results when you try to plot on timestamp X when X does not exist on the primary series.
Kind regards,
-ChrisLChris L.NinjaTrader Customer Service
Comment
-
-
Seems like when I do a reload is when it gets messed up, or if I switch to another chart. If I'm watching live, seems okay.
Comment
-
Chris L.NinjaTrader Customer Service
Comment
-
-
Latest Posts
Collapse
Topics | Statistics | Last Post | ||
---|---|---|---|---|
Started by naanku, Today, 07:25 PM
|
0 responses
3 views
0 likes
|
Last Post
by naanku
Today, 07:25 PM
|
||
Started by milfocs, Today, 07:23 PM
|
0 responses
1 view
0 likes
|
Last Post
by milfocs
Today, 07:23 PM
|
||
Started by PaulMohn, Today, 06:59 PM
|
0 responses
6 views
0 likes
|
Last Post
by PaulMohn
Today, 06:59 PM
|
||
Started by bortz, 11-06-2023, 08:04 AM
|
48 responses
1,750 views
0 likes
|
Last Post
by carnitron
Today, 06:57 PM
|
||
Started by Jonker, 04-27-2024, 01:19 PM
|
3 responses
23 views
0 likes
|
Last Post Today, 05:45 PM |
Comment