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
Bars Type Property
Collapse
X
-
Bars Type Property
Hi, is it possible to get a bars type property in my ninjascript, like this?
Tags: None
-
Hello shildebrand324,
Thanks for your post.
You could get the BarsPeriodType that a script is enabled on by using Bars.BarsPeriod.BarsPeriodType.
For example, if we add a print in a scrip that looks like, Print(Bars.BarsPeriod.BarsPeriodType); and we enable the script on a 1-Minute ES 03-23 chart, the print output will read 'Minute'.
See this help guide page for more information about BarsPeriod: https://ninjatrader.com/support/help...barsperiod.htm
Let me know if I may further assist you.Brandon H.NinjaTrader Customer Service
-
But I'm wanting a drop down in my script that shows the bar types, so I can pick it for my indicator.
Comment
-
Hello shildebrand324,
Thanks for your note.
Are you referring to dynamically adding additional data series to an indicator script so that the BarsType of the added series can be set by a user-defined property?
If so, dynamically adding additional data series is not supported. The BarsType value would need to be hardcoded into the AddDataSeries() method(s) in the indicator script.
From the AddDataSeries() help guide page linked below:
Arguments supplied to AddDataSeries() should be hardcoded and NOT dependent on run-time variables which cannot be reliably obtained during State.Configure (e.g., Instrument, Bars, or user input). Attempting to add a data series dynamically is NOT guaranteed and therefore should be avoided.
AddDataSeries(): https://ninjatrader.com/support/help...dataseries.htm
Please let me know if I may further assist.Brandon H.NinjaTrader Customer Service
Comment
-
-
Hello shildebrand324,
Thanks for your note.
I am not entirely sure I understand what you mean.
Please provide a brief description that explains exactly what your goal is so that I may accurately assist.
For example, are you creating an indicator and you want to add that indicator to an instrument on a chart that has a certain BarType?
If so, you would need to add the indicator to each data series bar type you want to run the indicator on. You could consider adding multiple data series to a single chart window that uses different BarTypes and apply to indicator to each data series added to that chart window.
See the help guide pages below for more information.
Working with Multiple Data Series on a Chart: https://ninjatrader.com/support/help...ata_series.htm
Working with Indicators on a Chart: https://ninjatrader.com/support/help...indicators.htm
Thanks in advance; I look forward to assisting further.Last edited by NinjaTrader_BrandonH; 12-12-2022, 03:07 PM.Brandon H.NinjaTrader Customer Service
Comment
-
I need to have the bar data series bar type based on a property value, instead of hardcoded, or the secondary data series bar type, have the same as primaryLast edited by shildebrand324; 12-12-2022, 03:15 PM.
Comment
-
Hello shildebrand324,
Thanks for your note.
I understand that you have an indicator script that uses AddDataSeries() to add secondary data series to the script.
The instrument, bar type, and value of the added series must be hardcoded as stated in the AddDataSeries() help guide page linked in post # 4. We would not be able to assist with dynamically adding secondary series since it is not supported.
This thread will be open for other community members to share their insights on unsupported code to accomplish this.
Let me know if I may assist further.Brandon H.NinjaTrader Customer Service
Comment
-
I'm actually doing the below, and would like for the BarsPeriodType.Range to come from the primary data series type.
AddVolumetric(null, BarsPeriodType.Range,BarsPeriod.Value,VolumetricDe ltaType.BidAsk,1);
Comment
-
Hello shildebrand324,
Thanks for the clarification.
The instrument name could be set to null or set to an empty string, such as " " to set the instrument to the primary series. However, all the other values such as BarsPeriodType, BarsPeriodTypeValue, etc. must be hardcoded in the AddVolumetric() method.
Please let me know if you have further questions.Brandon H.NinjaTrader Customer Service
Comment
-
-
Hello shildebrand324,
Thanks for your note.
We do not have any supported means for setting the BarsPeriodType argument of the AddVolumetric() method to use the primary series BarsType. This value would need to be hardcoded as stated in my previous post.
This thread will be open for community members to share their insights on unsupported code.
Let me know if you have further questions.Brandon H.NinjaTrader Customer Service
Comment
-
-
Hello shildebrand324,
Thanks for your note.
No, there are no supported or documented ways for accomplishing this. As previously stated, the value would need to be hardcoded in your additional data series method, such as AddVolumetric().
That said, this thread will be open for other community members to share their insights.
Let me know if I may assist further.Brandon H.NinjaTrader Customer Service
Comment
Latest Posts
Collapse
Topics | Statistics | Last Post | ||
---|---|---|---|---|
Started by ashwania, 05-23-2020, 04:10 PM
|
5 responses
473 views
0 likes
|
Last Post
by yertle
Today, 08:59 AM
|
||
Started by kaywai, Yesterday, 07:09 AM
|
5 responses
26 views
0 likes
|
Last Post Today, 08:50 AM | ||
Started by Ryan333, Yesterday, 05:25 PM
|
3 responses
15 views
0 likes
|
Last Post Today, 08:48 AM | ||
Started by ETFVoyageur, Today, 08:39 AM
|
2 responses
7 views
0 likes
|
Last Post Today, 08:46 AM | ||
Started by tkaboris, Yesterday, 07:53 PM
|
3 responses
15 views
0 likes
|
Last Post Today, 08:44 AM |
Comment