I have custom bar type and i want to use it secondary data series on my strategy. How can i do this?
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
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.JesseNinjaTrader Customer Service
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.JesseNinjaTrader Customer Service
Comment
-
Thank You for providing so interesting code example.
Here is output on my side:
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
-
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.
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.JesseNinjaTrader Customer Service
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.Chris L.NinjaTrader Customer Service
Comment
Latest Posts
Collapse
Topics | Statistics | Last Post | ||
---|---|---|---|---|
Started by Stanfillirenfro, Today, 07:23 AM
|
1 response
3 views
0 likes
|
Last Post Today, 07:37 AM | ||
Started by cmtjoancolmenero, Yesterday, 03:58 PM
|
2 responses
20 views
0 likes
|
Last Post Today, 07:24 AM | ||
Started by olisav57, Yesterday, 07:39 PM
|
1 response
9 views
0 likes
|
Last Post Today, 07:23 AM | ||
Started by cocoescala, 10-12-2018, 11:02 PM
|
7 responses
944 views
0 likes
|
Last Post
by Jquiroz1975
Today, 07:21 AM
|
||
Started by oviejo, Today, 12:28 AM
|
1 response
12 views
0 likes
|
Last Post Today, 07:20 AM |
Comment