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 JGriff5646, Today, 10:02 PM
        0 responses
        1 view
        0 likes
        Last Post JGriff5646  
        Started by AdamDJ8, Today, 09:18 PM
        0 responses
        2 views
        0 likes
        Last Post AdamDJ8
        by AdamDJ8
         
        Started by knowmad, Today, 03:52 AM
        2 responses
        28 views
        0 likes
        Last Post knowmad
        by knowmad
         
        Started by ETFVoyageur, Today, 07:05 PM
        0 responses
        11 views
        0 likes
        Last Post ETFVoyageur  
        Started by Orion815, 05-02-2024, 08:39 AM
        2 responses
        18 views
        0 likes
        Last Post Orion815  
        Working...
        X