I have custom bar type and i want to use it secondary data series on my strategy. How can i do this?
Announcement
Collapse
No announcement yet.
Partner 728x90
Collapse
NinjaTrader
How can i add custom bar type to strategy?
Collapse
X
-
Comment
-
Hello,
Thank you for the post.
I wanted to check, is this an item you have developed or something you have downloaded? This could be that the input is being limited to a certain set of types. If this is something you are creating, could you provide detail on the property used?
I look forward to being of further assistance.
Comment
-
Last edited by fx.practic; 08-16-2017, 07:58 AM.
Comment
-
Hello,
Thank you for the reply.
In this case, it would depend on how the property was created in the code for that script, the default BarsType selector would only display the internal types. If the developer has created their own property they could choose to list other bar types if they are available on the user's system and should be used with the strategy. This is not something we have a direct example of, but the developer could likely use logic like in the following post to determine if a specific type is included and what slot it occupies.
Please let me know if I may be of further assistance.
Comment
-
Thank You for providing so interesting code example.
Here is output on my side:
As we can see - UniRenko definitely present in system.HTML Code:Day - 5 Heiken Ashi - 9 Kagi - 10 Line Break - 13 Minute - 4 Month - 7 Point and Figure - 12 Range - 2 Renko - 11 Second - 3 Tick - 0 Volume - 1 Week - 6 Year - 8 UniRenko - 501
But, I don't see the way to make handy BarsType selector.
If to know exactly what bars are installed in particular system - custom enumeration can be used as type for BarsType selector.
And how to make universal bar selector, independent of particular NT8 configuration?
I feel hard lack of knowledges.Last edited by fx.practic; 08-17-2017, 12:41 PM.
Comment
-
Hello Jesse,Originally posted by NinjaTrader_Jesse View Post
Thanks a lot, that did the trick for Renko bars.
However, when I am trying to add some other third party bars that are coded in DLL, they just don't show up in the loop...
Here is a sample code that works with Renko:
IEnumerable<Type> bars = Assembly.GetExecutingAssembly().GetTypes().Where(t => typeof(BarsType).IsAssignableFrom(t));
foreach (Type v in bars)
{
if (v.FullName != null)
{
BarsType bar = Activator.CreateInstance(Type.GetType(v.FullName)) as BarsType;
bar.SetState(State.SetDefaults);
int id = (int)bar.BarsPeriod.BarsPeriodType;
Print(string.Format("{0} - {1}", bar.Name, id, id));
if (bar.Name == "BetterRenko")
{
AddDataSeries((BarsPeriodType) id, 2);
return;
}
bar.SetState(State.Terminated);
}
}
Do you have any tricks on how to add 3rd party bars that are coded within a DLL (and are not in the bin\Custom\BarsTypes\ folder)?
Thanks
Comment
-
Hello music_p13,
Please note, the bar finding syntax you have used should never be used directly with AddDataSeries specifically. That syntax should only be used in the original indicator to Print the integer ID number for the BarsType to the output window. Dynamically adding series like you have shown is not supported in NT8 and we document this in the AddDataSeries page to specifically avoid. Using dynamic variables with AddDataSeries is known to fail and should be avoided.
The problem here is that you are using an old sample, please redownload the bars type identifier and re-import it. The newer code also searches external assemblies.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.
I look forward to being of further assistance.
Comment
-
I am using the Unirenko bar that was created as a custom bar type, but I am trying to reference it in adding a volumetric data series so I can use the bar delta.. Can anyone help me here. Here is the code to add a volumetric data series for a builtin NT bar type as a starting point:
I installed the Unirenko type which is id = 501, and I want it set to Tick Trend =10, Open Offset = 4, Tick Reversal = 20
AddVolumetric("GC 04-20",BarsPeriodType.Minute,3,VolumetricDeltaType.Bi dAsk,1) ;
Comment
-
Hi Jim-Boulder, thanks for your note.
I discussed accessing the secondary Volumetric series here in this post:
You need to create a VolumetricBarsType object (this can be done at the class level, not necessarily in OnBarUpdate)
Please let me know if I can assist any further.
Comment
Latest Posts
Collapse
| Topics | Statistics | Last Post | ||
|---|---|---|---|---|
|
Started by NullPointStrategies, Today, 05:17 AM
|
0 responses
53 views
0 likes
|
Last Post
|
||
|
Started by argusthome, 03-08-2026, 10:06 AM
|
0 responses
130 views
0 likes
|
Last Post
by argusthome
03-08-2026, 10:06 AM
|
||
|
Started by NabilKhattabi, 03-06-2026, 11:18 AM
|
0 responses
70 views
0 likes
|
Last Post
|
||
|
Started by Deep42, 03-06-2026, 12:28 AM
|
0 responses
44 views
0 likes
|
Last Post
by Deep42
03-06-2026, 12:28 AM
|
||
|
Started by TheRealMorford, 03-05-2026, 06:15 PM
|
0 responses
49 views
0 likes
|
Last Post
|

Comment