Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

AddDataSeries/BarsPeriodType Bars with more that two values?

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

    AddDataSeries/BarsPeriodType Bars with more that two values?

    I have custom bar types that have three values to set, yet BarsPeriodType only supports Value and Value2. How do you add these bar types to a Strategy or Indicator?

    Examples:

    Built-in:
    AddDataSeries(Data.BarsPeriodType.Minute, 1);
    AddDataSeries(Data.BarsPeriodType.Tick, 50);

    Custom with one:
    AddDataSeries(new BarsPeriod() {BarsPeriodType = (BarsPeriodType)149, BarsPeriodTypeName = "149", Value = 4});

    Custom with two:
    AddDataSeries(new BarsPeriod() {BarsPeriodType = (BarsPeriodType)22220, BarsPeriodTypeName = "22220", Value = 8, Value2 = 8});

    Trying the following for custom bar types which take three:
    AddDataSeries(new BarsPeriod() {BarsPeriodType = (BarsPeriodType)1342, BarsPeriodTypeName = "1342", Value = 10, Value2 = 14024, Value3 = 674});
    AddDataSeries(new BarsPeriod() {BarsPeriodType = (BarsPeriodType)20122, BarsPeriodTypeName = "20122", Value = 4, Value2 = 1, Value3 = 7});

    Gives the following:
    'NinjaTrader.Data.BarsPeriod' does not contain a definition for 'Value3'

    Thank you.

    #2
    Originally posted by Darquer View Post
    I have custom bar types that have three values to set, yet BarsPeriodType only supports Value and Value2. How do you add these bar types to a Strategy or Indicator?

    Examples:

    Built-in:
    AddDataSeries(Data.BarsPeriodType.Minute, 1);
    AddDataSeries(Data.BarsPeriodType.Tick, 50);

    Custom with one:
    AddDataSeries(new BarsPeriod() {BarsPeriodType = (BarsPeriodType)149, BarsPeriodTypeName = "149", Value = 4});

    Custom with two:
    AddDataSeries(new BarsPeriod() {BarsPeriodType = (BarsPeriodType)22220, BarsPeriodTypeName = "22220", Value = 8, Value2 = 8});

    Trying the following for custom bar types which take three:
    AddDataSeries(new BarsPeriod() {BarsPeriodType = (BarsPeriodType)1342, BarsPeriodTypeName = "1342", Value = 10, Value2 = 14024, Value3 = 674});
    AddDataSeries(new BarsPeriod() {BarsPeriodType = (BarsPeriodType)20122, BarsPeriodTypeName = "20122", Value = 4, Value2 = 1, Value3 = 7});

    Gives the following:
    'NinjaTrader.Data.BarsPeriod' does not contain a definition for 'Value3'

    Thank you.

    They are Value, Value2, and BasePeriodValue.
    RJay
    NinjaTrader Ecosystem Vendor - Innovative Trading Solutions

    Comment


      #3
      Hello Darquer,

      Welcome to the NinjaTrader forums!

      RJay is correct, the BasePeriodValue can also be used.

      You may want to view the code of the script to see which values are being renamed with the SetPropertyName() method.
      Chelsea B.NinjaTrader Customer Service

      Comment


        #4
        Thanks, RJay.

        AddDataSeries(new BarsPeriod() {BarsPeriodType = (BarsPeriodType)1342, BarsPeriodTypeName = "1342", Value = 10, Value2 = 674, BaseBarsPeriodValue = 14024});

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by CaptainJack, 05-29-2026, 05:09 AM
        0 responses
        163 views
        0 likes
        Last Post CaptainJack  
        Started by CaptainJack, 05-29-2026, 12:02 AM
        0 responses
        82 views
        0 likes
        Last Post CaptainJack  
        Started by charlesugo_1, 05-26-2026, 05:03 PM
        0 responses
        125 views
        0 likes
        Last Post charlesugo_1  
        Started by DannyP96, 05-18-2026, 02:38 PM
        1 response
        206 views
        0 likes
        Last Post NinjaTrader_ChelseaB  
        Started by CarlTrading, 05-11-2026, 05:56 AM
        0 responses
        185 views
        0 likes
        Last Post CarlTrading  
        Working...
        X