Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Getting all details for a new data series.

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

    Getting all details for a new data series.

    I have created my own Custom Bar for Renko. In my strategy I have the following code to add a secondary Data Series


    Code:
    else if (State == State.Configure)
    
                {        
    
                    AddDataSeries(new BarsPeriod { BarsPeriodType = (BarsPeriodType) 123460, BarsPeriodTypeName = "JGRenkoBars", Value = _hTFRenkoBrickSize, Value2 = _hTFRenkoThreshold});
    
                }
    Two questions. When setting the primary data series using the Data Series Configuration window, I have the option of setting the Days To Load Parameter and the Price based parameter. How do I set each of those parameters in code?



    #2
    Hello GARZONJ,

    Thanks for your post.

    Days To Load would only be available from the Data Series window. When using AddDataSeries, you could specify barsToLoad, but this will only affect the first added Data Series.

    Changing the Price Based On parameter would involve using an AddDataSeries() overload that allows you to specify a MarketDataType.

    Please see the AddDataSeries() documentation for a full list of overloads as well as a list of tips and advisories. Please also note that while using a variable in State.Configure will generally work in most cases, this is not supported and you may see an error "Unable to load bars series. Your NinjaScript may be trying to use an additional data series dynamically in an unsupported manner."



    Please let us know if you have any additional questions.

    Comment


      #3
      Jim,

      Just so that I am clear:

      Day to Load parameter
      This parameter is only available in the Data Series configuration window. For my strategy I only configure the Primary Data Series using the configuration window. Do all additional Data Series added through the AddDataSeries method use the same Day To Load as the primary Data Series?

      Price Based On parameter
      As you can see from my sample code included in the original post, I am using a custom bar type. Could you tell me how do I overload the marketDataType parameter when working with custom bar type? I have tried it many ways and I get all types of errors. Please advice.

      Thanks,

      Comment


        #4
        Hello GARZONJ,

        Unless it is the first data series added that uses the barsToLoad overload, data will be requested to match when the primary data series starts.

        For your case, since you are using a BarsPeriod parameter, MarketDataType can be set within the BarsPeriod that you create.

        Code:
        AddDataSeries(new BarsPeriod { BarsPeriodType = (BarsPeriodType) 123460, BarsPeriodTypeName = "JGRenkoBars", Value = _hTFRenkoBrickSize, Value2 = _hTFRenkoThreshold, MarketDataType = MarketDataType.Last});


        Please let me know if there is anything else I can do to help.

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by NullPointStrategies, Yesterday, 05:17 AM
        0 responses
        64 views
        0 likes
        Last Post NullPointStrategies  
        Started by argusthome, 03-08-2026, 10:06 AM
        0 responses
        139 views
        0 likes
        Last Post argusthome  
        Started by NabilKhattabi, 03-06-2026, 11:18 AM
        0 responses
        75 views
        0 likes
        Last Post NabilKhattabi  
        Started by Deep42, 03-06-2026, 12:28 AM
        0 responses
        45 views
        0 likes
        Last Post Deep42
        by Deep42
         
        Started by TheRealMorford, 03-05-2026, 06:15 PM
        0 responses
        50 views
        0 likes
        Last Post TheRealMorford  
        Working...
        X