• If this is your first visit, you will have to register before you can post. To view messages, please scroll below and select the forum that you would like to visits. Questions? Be sure to check out the Forum FAQ.

Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

How can i add custom bar type to strategy?

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    How can i add custom bar type to strategy?

    Hello,

    I have custom bar type and i want to use it secondary data series on my strategy. How can i do this?

    #2
    Hello,

    Please see the AddDataSeries documentation, there is an example that demonstrates using a custom BarsType. The "Tips:" section contains a few samples on adding custom types.
    http://ninjatrader.com/support/helpG...=AddDataSeries



    Please let me know if I may be of further assistance.
    JesseNinjaTrader Customer Service

    Comment


      #3
      Hello Jesse,

      Sorry i did not pay attention. Thank you so much...

      Comment


        #4
        Is it possible to chose custom bar type as a parameter?

        I installed UniRenko and can choose it as a primary DataSeries, but don't see it in BarTypes list for property:
        Attached Files
        fx.practic
        NinjaTrader Ecosystem Vendor - fx.practic

        Comment


          #5
          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


            #6
            This is UniRenko bar type NT8b9 downloaded here:
            http://ninjatrader.com/support/forum...atid=9&lpage=1

            I installed UniRenko bar type NT8b9 in general way from zip file, I can see and use "UniRenko" bars type in Chart dialogue, as primary series in Strategy Analyser, but, I can't see it in drop down list of custom property of BarsPeriodType.
            Last edited by fx.practic; 08-16-2017, 07:58 AM.
            fx.practic
            NinjaTrader Ecosystem Vendor - fx.practic

            Comment


              #7
              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.

              http://ninjatrader.com/support/forum...d=7&linkid=913


              Please let me know if I may be of further assistance.
              JesseNinjaTrader Customer Service

              Comment


                #8
                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
                As we can see - UniRenko definitely present in system.
                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.
                fx.practic
                NinjaTrader Ecosystem Vendor - fx.practic

                Comment


                  #9
                  Hello,

                  Any example on how to add the Renko or any exotic bar types as secondary data series?

                  Thanks

                  Comment


                    #10
                    Hello music_p13,

                    You can find this in the help guide on the following page:

                    https://ninjatrader.com/support/help...dataseries.htm

                    Please see the Tips in the AddDataSeries page for Custom BarsTypes.

                    https://ninjatrader.com/support/help...=adddataseries



                    I look forward to being of further assistance.
                    JesseNinjaTrader Customer Service

                    Comment


                      #11
                      Originally posted by NinjaTrader_Jesse View Post
                      Hello music_p13,

                      You can find this in the help guide on the following page:

                      https://ninjatrader.com/support/help...dataseries.htm

                      Please see the Tips in the AddDataSeries page for Custom BarsTypes.

                      https://ninjatrader.com/support/help...=adddataseries



                      I look forward to being of further assistance.
                      Hello Jesse,

                      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


                        #12
                        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.
                        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.


                        I look forward to being of further assistance.
                        JesseNinjaTrader Customer Service

                        Comment


                          #13
                          Thanks!

                          The new code did the trick!

                          Thanks for very fast response!

                          Comment


                            #14
                            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) ;

                            Jim-Boulder
                            NinjaTrader Ecosystem Vendor - Elephant Tracks

                            Comment


                              #15
                              Hi Jim-Boulder, thanks for your note.

                              I discussed accessing the secondary Volumetric series here in this post:
                              https://ninjatrader.com/support/foru...nd-data-series

                              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 Serge A, Today, 04:03 PM
                              0 responses
                              2 views
                              0 likes
                              Last Post Serge A
                              by Serge A
                               
                              Started by horace chow, Today, 04:00 PM
                              0 responses
                              2 views
                              0 likes
                              Last Post horace chow  
                              Started by JBTrader2005, Today, 03:57 PM
                              0 responses
                              2 views
                              0 likes
                              Last Post JBTrader2005  
                              Started by Austiner87, Yesterday, 09:29 PM
                              1 response
                              18 views
                              0 likes
                              Last Post NinjaTrader_Kate  
                              Started by webus, Today, 03:34 PM
                              0 responses
                              9 views
                              0 likes
                              Last Post webus
                              by webus
                               
                              Working...
                              X