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 NullPointStrategies, Today, 05:17 AM
        0 responses
        53 views
        0 likes
        Last Post NullPointStrategies  
        Started by argusthome, 03-08-2026, 10:06 AM
        0 responses
        130 views
        0 likes
        Last Post argusthome  
        Started by NabilKhattabi, 03-06-2026, 11:18 AM
        0 responses
        70 views
        0 likes
        Last Post NabilKhattabi  
        Started by Deep42, 03-06-2026, 12:28 AM
        0 responses
        44 views
        0 likes
        Last Post Deep42
        by Deep42
         
        Started by TheRealMorford, 03-05-2026, 06:15 PM
        0 responses
        49 views
        0 likes
        Last Post TheRealMorford  
        Working...
        X