Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

adding custom AddDataSeries minute bars vs unirenko charts

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

    adding custom AddDataSeries minute bars vs unirenko charts

    i know how to add a dataseries of a minute bar but how do you add the information of a unirenko bar

    AddDataSeries(Data.BarsPeriodType.Minute, 30);

    here is the info in the unirenko bartype


    Description = @"NT8 UniRenko";
    Name = "UniRenko";
    BarsPeriod = new BarsPeriod { BarsPeriodType = (BarsPeriodType)20, BarsPeriodTypeName = "UniRenko(20)", Value = 1 };
    BuiltFrom = BarsPeriodType.Tick;
    DaysToLoad = 3;
    DefaultChartStyle = Gui.Chart.ChartStyleType.CandleStick;
    IsIntraday = true;


    public override void ApplyDefaultValue(BarsPeriod period)
    {
    period.BarsPeriodTypeName = "UniRenko";
    period.BaseBarsPeriodValue = 10; //### Open Offset Value
    period.Value =4; //### Trend Value
    period.Value2 = 20; //### Reversal Value
    }

    // I tried this but I can't figure it out.


    AddDataSeries(NinjaTrader.NinjaScript.BarsTypes.Un iRenko,004010020);

    #2
    I placed this code in and wanted to see if the dataseries was printing properly


    if (State == State.SetDefaults)
    {

    //AddDataSeries(Data.BarsPeriodType.Custom1,00400200 4);
    //AddDataSeries("sss",BarsPeriodType.Tick,


    BarsPeriod = new BarsPeriod {
    BarsPeriodType = (BarsPeriodType)12345,
    BarsPeriodTypeName = "UniRenko",
    };


    }
    else if (State == State.Configure)
    {


    AddDataSeries(new BarsPeriod() {
    BarsPeriodType = (BarsPeriodType)12345,
    Value = 20,
    Value2 = 4,
    BaseBarsPeriodValue = 10
    });

    }


    I tested on a 1 minute chart
    but my data is incorrect


    if(BarsInProgress ==1)
    {
    Print(Close[0] + "Close");
    Print(High[0] + "High");
    Print(Low[0] + "Low");
    Print(Open[0] + "Open");
    }

    this is my unirenko chart 10,4,20
    o:6748.0
    H: 6748.75
    L6744.75
    C:6748.00

    on my 1 minute chart it states
    O6749.75
    C:6748,75
    H:6754.5
    L:6744.75

    I am trying to get these to match

    Comment


      #3
      I got it solved.


      This is my answer.

      {


      AddDataSeries(new BarsPeriod() {
      BarsPeriodType =(BarsPeriodType) 12345,
      BarsPeriodTypeName = "UniRenko",
      BaseBarsPeriodValue = 10,
      Value = 20,
      Value2 = 4
      });


      and testing

      protected override void OnBarUpdate()
      {


      if(CurrentBars[0] <1 || CurrentBars[1] <1)
      return;


      if(BarsInProgress ==0)
      {
      Print("5 minute");
      Print(Open[0] + "Open");
      Print(Close[0] + "Close");
      Print(High[0] + "High");
      Print(Low[0] + "Low");

      }


      if(BarsInProgress ==1)
      {
      Print("^^^^^^^^^^");
      Print(Open[0] + "Open");
      Print(Close[0] + "Close");
      Print(High[0] + "High");
      Print(Low[0] + "Low");

      }
      }

      Comment


        #4
        Hello ballboy11,

        Thanks for your inquiry and sharing your results.

        For the thread's reference, when adding a data series for a custom BarType, the AddDataSeries overload using a BarsPeriod must be used. This BarsPeriod must be made with the BarType's index casted to BarsPeriodType. This can be referenced in the custom BarType's source code, or the can be asked from the BarType's developer.

        Other BarsPeriod properties will also have to be supplied to configure the BarType. The BarsPeriod documentation page can be referenced for how NinjaTrader uses these properties. Their usage likely will vary for the custom BarType, so referencing that source code or consulting the developer is advised.

        BarsPeriod - https://ninjatrader.com/support/help...barsperiod.htm

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

        Please let us know if there is anything else we can do to assist.

        Comment


          #5
          Have error on add data series

          I have 2 indicators that I need to add custom data series
          if (State == State.Configure)
          {
          AddDataSeries(new BarsPeriod() {
          BarsPeriodType =(BarsPeriodType) 12345,
          BarsPeriodTypeName = "UniRenko",
          BaseBarsPeriodValue = nOpenOffset,
          Value = nRangeReversalSize,
          Value2 = nTrend
          });

          }

          This works on my computer but when I installed it to a friends computer to backtest I get an error.

          In the trace log this is what I get.
          Error on calling 'OnStateChange' method: 'AddDataSeries' method: There exists no implementation for this 'BarsPeriod' object.


          I checked if they have a UniRenko Bar on their computer and they do.

          Indicator was compressed to dll for testing.

          Comment


            #6
            Hello ballboy11,

            I may suggest including the custom BarsType with your export. It could be that the BarsType on your friend's PC has a different index for the BarsPeriodType. I have attached 2 examples showing how custom BarsTypes can be added to an indicator.

            Note: 3rd party custom BarsTypes are not supported by NinjaTrader. Please consult the original BarsType developer for any related questions with custom BarsTypes.

            Please let us know if we can be of further assistance.
            Attached Files

            Comment


              #7
              this information is in the unirenko I downloaded from you.



              Description = @"Universal renko bar type. Ported by Sim22, 2015. [email protected]";
              Name = "UniRenko";
              BarsPeriod = new BarsPeriod { BarsPeriodType = (BarsPeriodType) 501, BarsPeriodTypeName = "UniRenkoBarsType(501)", Value = 1 };
              BuiltFrom = BarsPeriodType.Tick;
              DaysToLoad = 3;
              IsIntraday


              so when I install this unirenko it has the custom value of 501 so when I add this to my indicator

              if (State == State.Configure)
              {


              AddDataSeries(new BarsPeriod() {
              BarsPeriodType = (BarsPeriodType)501,// do I use 501, because i used 12345 in my code earlier
              Value = 20,
              Value2 = 4,
              BaseBarsPeriodValue = 10
              });



              }

              O

              Comment


                #8
                Hello ballboy11,

                The UniRenko BarsType included with this package has its BarsPeriodType index defined on line 52.

                BarsPeriod = new BarsPeriod { BarsPeriodType = (BarsPeriodType) 501, BarsPeriodTypeName = "UniRenkoBarsType(501)", Value = 1 };
                You may reference the custom BarsType's source code for the BarsPeriodType index on your end, or you may consult the BarsType developer that has created the BarsType.

                Please let me know if you have any questions.

                Comment


                  #9
                  Thank you. I understand where to get the code, but my question is if I am creating an indicator such as the 501 reference in your statement below, when I produce all indicators do I reference the 501?

                  Comment


                    #10
                    Hello ballboy11,

                    Yes, the BarsPeriodType index should not change unless the BarsType changes, so you will have to use consistent references in each of your indicators.

                    I.E BarsType has 501: Indicator A and Indicator B must both reference (BarsPeriodType)501 if they are to add that BarsType.

                    Please let me know if this does not resolve your inquiry.

                    Comment

                    Latest Posts

                    Collapse

                    Topics Statistics Last Post
                    Started by Geovanny Suaza, 02-11-2026, 06:32 PM
                    0 responses
                    571 views
                    0 likes
                    Last Post Geovanny Suaza  
                    Started by Geovanny Suaza, 02-11-2026, 05:51 PM
                    0 responses
                    331 views
                    1 like
                    Last Post Geovanny Suaza  
                    Started by Mindset, 02-09-2026, 11:44 AM
                    0 responses
                    101 views
                    0 likes
                    Last Post Mindset
                    by Mindset
                     
                    Started by Geovanny Suaza, 02-02-2026, 12:30 PM
                    0 responses
                    549 views
                    1 like
                    Last Post Geovanny Suaza  
                    Started by RFrosty, 01-28-2026, 06:49 PM
                    0 responses
                    550 views
                    1 like
                    Last Post RFrosty
                    by RFrosty
                     
                    Working...
                    X