Announcement

Collapse

Looking for a User App or Add-On built by the NinjaTrader community?

Visit NinjaTrader EcoSystem and our free User App Share!

Have a question for the NinjaScript developer community? Open a new thread in our NinjaScript File Sharing Discussion Forum!
See more
See less

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.
    JimNinjaTrader Customer Service

    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.
        JimNinjaTrader Customer Service

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by GussJ, 03-04-2020, 03:11 PM
        11 responses
        3,227 views
        0 likes
        Last Post xiinteractive  
        Started by andrewtrades, Today, 04:57 PM
        1 response
        13 views
        0 likes
        Last Post NinjaTrader_Manfred  
        Started by chbruno, Today, 04:10 PM
        0 responses
        7 views
        0 likes
        Last Post chbruno
        by chbruno
         
        Started by josh18955, 03-25-2023, 11:16 AM
        6 responses
        440 views
        0 likes
        Last Post Delerium  
        Started by FAQtrader, Today, 03:35 PM
        0 responses
        12 views
        0 likes
        Last Post FAQtrader  
        Working...
        X