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
Additioanl data series being a multiplier of the primary data series
Collapse
X
-
Additioanl data series being a multiplier of the primary data series
Is it possible to have the [1] array data series be set to a multiplier of the primary [0] array data series via state.configure when the indicator/strategy is loaded. For example, let's assume I'm using a 1m data series for array [0] and when i set this value i want array [1] to multiply this by 2 (this could be an int that is preset or adjustable by the user via the properties) so that regardless of what time frame I'm using the additional data series will always be a set ratio/multiplier of the first one. This would be particularly useful for indicators that are running on the chart. Based on previous experience with additional data series I'm assuming this is not something you guys would advocate doing but if its possible please tell me how to do it.Tags: None
-
Hello gordongekko,
Thanks for your inquiry.
It wouldn't be possible to say, AddDataSeries() for a multiple of the primary data series, but you could create a solution that accomplishes this.
For example, you could create Series<double>'s for each price series you would like to be multiplied and then add a data series for the same instrument/same period that would be used for the primary data series. This would have to be using AddDataSeries() overloads that would inherit the period type from the primary data series or the instrument from the primary data series since data series cannot be added automatically.
With that setup, you will have separate series that contain multiples, and then you could reference those Series instead of referencing the Closes series, etc. for the secondary data series. Since the added data series would have the same instrument and period as the primary, you could even place logic based on the "multiplied series" for BarsInProgress == 1 OnBarUpdate iterations.
I've included some Multi Time Frame documentation for the thread's reference.
Multi Time Frame and Instruments - https://ninjatrader.com/support/help...nstruments.htm
AddDataSeries() - https://ninjatrader.com/support/help...dataseries.htm
Series<T> - https://ninjatrader.com/support/help...us/seriest.htm
Please let us know if we can be of further assistance.JimNinjaTrader Customer Service
- Likes 1
-
What I want to do is create a way for an additional data series to change it's value based on a multiple or ratio of primary data series when the user changes the bar size, type, etc from the chart. So for example, if i have a 1m chart up and and im using a multiplier of 5 then i want the second data series to be tracking the 5m bars without having to manually adjust that in the properties every time i want to change the time frame or bar increment on the chart. The AddDataSeries() appears to only be usable in State.Configure so how can this multiplier be referenced from that method? I don't get how this is possible when i can't add a data series via OnBarUpdate. Can you post an example of how the values from the primary data series can be referenced from the State.Configure or if it has to be done another way please post an example of the easiest way to accomplish this.
Comment
-
private Series<double> x2;
if(State == State.DataLoaded)
{
x2 = new Series<double>(this, MaximumBarsLookBack.TwoHundredFiftySix);
}
Do I need to add the multiplier to "this" ?
if(State == State.DataLoaded)
{
x2 = new Series<double>(this*multiplier, MaximumBarsLookBack.TwoHundredFiftySix);
}
I'm assuming this is referencing the primary data series but it doesn't show the bar size and type so how do I get the ratio i'm looking for so i can can use it when OnBarUpdate is called?Last edited by gordongekko; 11-09-2018, 04:59 PM.
Comment
-
Hello gordongekko,
Thanks for your questions.
Only data series that are added with AddDataSeries() will be processed in OnBarUpdate(). Series<double>'s that are added to the NinjaScript are best thought of as arrays that are synchronized to the primary data series.
You could use "this" for the instrument name in AddDataSeries() to reference the instrument of the primary data series, but it would not be supported to reference the BarsPeriod of the primary data series that is added from State.Configure. I would recommend to make different versions of the strategy to apply against each time frame of the primary data series.
We have a feature request tracking interest behind dynamically adding data series. That would be to add a data series based off of other data series that are loaded. The ticket ID for this request is SFT-882 and I have added a vote on your behalf.
We cannot offer an ETA or promise of fulfillment, but we are tracking interest and the ticket ID number will be noted in the help guide when a new build gets released with the feature implemented.
Release Notes - https://ninjatrader.com/support/help...ease_notes.htm
Please let us know if you have any additional questions.JimNinjaTrader Customer Service
Comment
Latest Posts
Collapse
Topics | Statistics | Last Post | ||
---|---|---|---|---|
Started by Padan, Today, 02:02 AM
|
9 responses
21 views
0 likes
|
Last Post Today, 03:27 PM | ||
Started by spottysallrite, Today, 11:31 AM
|
7 responses
21 views
0 likes
|
Last Post Today, 03:26 PM | ||
Started by nandhumca, Today, 03:15 PM
|
1 response
2 views
0 likes
|
Last Post Today, 03:23 PM | ||
Started by PopovDS, 03-11-2024, 12:49 PM
|
3 responses
17 views
0 likes
|
Last Post
by PopovDS
Today, 03:16 PM
|
||
Started by Lele2k24, Yesterday, 11:24 AM
|
12 responses
37 views
0 likes
|
Last Post Today, 03:07 PM |
Comment