• 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

Help. Adding custom bar type to strategy.

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

    Help. Adding custom bar type to strategy.

    Hi,

    I am in the process of creating a strategy. I have a custom bar type that I had created based on Renko.

    When i want to use this custom bar type, how can i add it to my strategy?

    This is what i have:

    else if (State == State.Configure)
    {
    AddDataSeries(BarsPeriodType.myCustomBarType, 4, 5, 11);
    }



    I am trying to do this but it doesn't show my custom bar type listed and when i add it anyways, it complains with the following error message:

    "NinjaTrader.Data.BarsPeriodType' does not contain a definition for 'myCustomBarType'


    #2
    Hello priceisking,

    Thank you for your reply.

    You've got the incorrect syntax for adding a custom bars type to your strategy.

    You can add a custom BarsType which is installed on your system by casting the registered enum value for that BarsPeriodType. For example: AddDataSeries((BarsPeriodType)14,10);

    You'd first need to get the registered enum value. You can get that by using this indicator which is publicly available on our NinjaTrader Ecosystem website:Here is a basic guideline of how to import NinjaScript add-ons in NinjaTrader 8:

    Note — To import NinjaScripts you will need the original .zip file.

    To Import:
    1. Download the NinjaScripts to your desktop, keep them in the compressed .zip file.
    2. From the Control Center window select the menu Tools > Import > NinjaScript Add-on...
    3. Select the downloaded .zip file
    4. NinjaTrader will then confirm if the import has been successful.

    Critical - Specifically for some NinjaScripts, it will prompt that you are running newer versions of @SMA, @EMA, etc. and ask if you want to replace, press 'No'

    Once installed, you may add the indicator to a chart by:
    • Right click your chart > Indicators... > Select the Indicator from the 'Available' list on the left > Add > OK
    Once you know what the custom bar type's enum is, you can then use that when adding your data series:

    AddDataSeries((BarsPeriodType)enum,10);

    Make sure you use the actual value that you got for your bars type from the above indicator - adding data series dynamically is not supported, so you can't use a variable there.

    Here's a link to our help guide on the AddDataSeries() method:
    https://ninjatrader.com/support/help...dataseries.htm

    Note that the information I've given above is touched on in the Tips on that page.

    Please let me know if I can be of further assistance.

    The NinjaTrader Ecosystem website is for educational and informational purposes only and should not be considered a solicitation to buy or sell a futures contract or make any other type of investment decision. The add-ons listed on this website are not to be considered a recommendation and it is the reader's responsibility to evaluate any product, service, or company. NinjaTrader Ecosystem LLC is not responsible for the accuracy or content of any product, service or company linked to on this website.


    Kate W.NinjaTrader Customer Service

    Comment


      #3
      Ok This is great information. Thank you. I did load it and this is what i show:

      BetterRenko - 17
      Day - 5
      Heiken Ashi - 9
      Kagi - 10
      Line Break - 13
      Minute - 4
      Month - 7
      myCustomBarType - 2018
      Point and Figure - 12
      Range - 2
      Renko - 11
      Second - 3
      Tick - 0
      Volume - 1
      Volumetric - 14
      Week - 6
      Year - 8



      I added the series as follows:

      AddDataSeries((BarsPeriodType)2018,004011005);


      Is this the correct way?

      Also, if I were to package this and provide it to our customer, would I have to code and grab the number from their installation and pass it on to the strategy?

      I'm assuming the custom bar type will have a different number in another computer right?

      Comment


        #4
        Hello priceisking,

        Thank you for your reply.

        That looks correct for a Renko based bar type.

        The BarsPeriodType number is declared within the code of the Bar Type script. You should see a line like this in the script for the Bar Type:

        BarsPeriod = new BarsPeriod { BarsPeriodType = (BarsPeriodType) 2018, BarsPeriodTypeName = "UniRenko(2018)", Value = 1 };

        This will be the same on all computers unless the script is modified.

        Please let us know if we may be of further assistance to you.

        Kate W.NinjaTrader Customer Service

        Comment


          #5
          Awesome! Thank you for the quick reply. Appreciate it. Got it to work!

          Comment


            #6
            I am referring to post #4. How would I add UniRenkoBars to a strategy? The bar type comes with three parameters. AddDataSeries() only allows for specifying a single parameter - the brick size. There are no fields for the reversal size and the offset.

            In order to add UniRenko bars to a strategy I would need to create a specific method AddUniRenko() - such as AddRenko() - to be able to call the bars.

            Nota: UniRenko bars do not always produce correct highs and lows, volume is false and the time stamp is delayed, so in any case they cannot be correctly synchronized. But let us assume that I am going to modify them to work correctly. How would I add them to a strategy?

            Comment


              #7
              Already found the solution to my question. The following line will add UniRenko (2,6,2) bars programmatically:

              AddDataSeries(new BarsPeriod(){BarsPeriodType = (BarsPeriodType) 501, Value = 2, Value2 = 6, BaseBarsPeriodValue = 2});

              Again I advise against the use of these bars, as they come with a few bugs (single tick highs and lows not detected, false volume, not backtestable).

              Comment

              Latest Posts

              Collapse

              Topics Statistics Last Post
              Started by y97p6e18, Today, 02:35 AM
              0 responses
              3 views
              0 likes
              Last Post y97p6e18  
              Started by cls71, Today, 02:20 AM
              0 responses
              1 view
              0 likes
              Last Post cls71
              by cls71
               
              Started by MarkaAllgood, Today, 01:17 AM
              0 responses
              3 views
              0 likes
              Last Post MarkaAllgood  
              Started by assik, Today, 01:00 AM
              0 responses
              5 views
              0 likes
              Last Post assik
              by assik
               
              Started by manueldecastro, Yesterday, 11:55 PM
              0 responses
              4 views
              0 likes
              Last Post manueldecastro  
              Working...
              X