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 CarlTrading, 03-31-2026, 09:41 PM
        1 response
        41 views
        0 likes
        Last Post NinjaTrader_ChelseaB  
        Started by CarlTrading, 04-01-2026, 02:41 AM
        0 responses
        20 views
        0 likes
        Last Post CarlTrading  
        Started by CaptainJack, 03-31-2026, 11:44 PM
        0 responses
        28 views
        1 like
        Last Post CaptainJack  
        Started by CarlTrading, 03-30-2026, 11:51 AM
        0 responses
        45 views
        0 likes
        Last Post CarlTrading  
        Started by CarlTrading, 03-30-2026, 11:48 AM
        0 responses
        37 views
        0 likes
        Last Post CarlTrading  
        Working...
        X