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

Questions about AddDataSeries() and Secondary PriceBars

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

  • NinjaTrader_AlanP
    replied
    Hello EquityTrader,

    Thank you for writing in.

    Yes, if you were to add two calls for AddDataSeries with the same parameters passed into it, you would have 2 additional data series added.

    You could always test this by adding print statements such as Print(Closes[1][0]); and Print(Closes[2][0];, whereas the first print statement is referring to the 1st additional data series and the send to the 2nd additional data series, you should see both statements print.

    It’s not a good idea to pass Ticker variables into the AddDataSeries call, cause if you disable strategy then change parameter, the strategy won't reflect that change because the strategy has already been initialized. So to answer question 2, it is not recommended.

    Regarding question three, when checking Use primary instrument, the syntax the builders uses becomes AddDataSeries(BarsPeriodType periodType, int period), which does not all you to designate the Price based on. I will submit a feature request for you to allow this to be specified.

    Please let us know if you need further assistance.

    Leave a comment:


  • Questions about AddDataSeries() and Secondary PriceBars

    Hello,

    It seems like the NT8 AddDataSeries() method and secondary pricebars handling is significantly better than it was in NT7. First off, thank you! Secondly, I have some questions about these things:

    Question #1: Is it true that in NT8, calling AddDataSeries() twice (in the appropriate OnStateChange() "else if (State == State.Configure)" branch) with the exact same values always adds 2 secondary pricebars to the strategy, instead of adding the secondary pricebars once?

    For instance, if I create a strategy with 2 input parameters of type "string" called "Symbol1" and "Symbol2", and the user decides that they want both symbols to be "SPY", will 2 secondary pricebars always be added?

    Code:
    AddDataSeries(Symbol1, Data.BarsPeriodType.Day, 1, Data.MarketDataType.Last);	
    AddDataSeries(Symbol2, Data.BarsPeriodType.Day, 1, Data.MarketDataType.Last);
    Is there any case where NT8 wouldn't add one secondary pricebars series for each call of "AddDataSeries()"?


    Question #2: I noticed that both input parameters and internal variables declared in the NT8 Strategy Builder get assigned a default value in OnStateChange() "if (State == State.SetDefaults)" branch. Is it safe to use any input param or internal variable as one of the parameters passed to AddDataSeries(), and it is a safe assumption that the default values assigned to the input param or internal variable will be the value that is used?


    Question #3: Why does the NT8 Strategy Builder "Add Additional Data" dialogbox disable the "Price based on (last, bid, ask)" combobox when "Use primary instrument" is checked? Does this mean that as a NinjaScript programmer, I shouldn't be calling "AddDataSeries()" using the primary instrument as the symbol but using Bid or Ask data instead of "Last" data?


    Thank you very much in advance,

    EquityTrader

Latest Posts

Collapse

Topics Statistics Last Post
Started by funk10101, Today, 09:43 PM
0 responses
6 views
0 likes
Last Post funk10101  
Started by pkefal, 04-11-2024, 07:39 AM
11 responses
37 views
0 likes
Last Post jeronymite  
Started by bill2023, Yesterday, 08:51 AM
8 responses
44 views
0 likes
Last Post bill2023  
Started by yertle, Today, 08:38 AM
6 responses
26 views
0 likes
Last Post ryjoga
by ryjoga
 
Started by algospoke, Yesterday, 06:40 PM
2 responses
24 views
0 likes
Last Post algospoke  
Working...
X