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

BarsPeriod.Id in NT 8?

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

    BarsPeriod.Id in NT 8?

    in NT7 when using multiple instruments in a script, the secondary bars were set to use the same period as the primary bars with this line:

    Code:
    Add(XYZ, BarsPeriod.Id, BarsPeriod.Value);
    However, BarsPeriod.Id is not valid in NT8. For NT8 can I accomplish the same thing using:

    Code:
    AddDataSeries(XYZ, BarsPeriod.BaseBarsPeriodType, BarsPeriod.Value);
    It works, but is this the correct way to do that or could I get some unwanted results in the future?

    #2
    Hello MM345,

    Officially dynamically adding series is not supported for NinjaTrader 7 or for NinjaTrader 8.

    From the help guide:
    "Arguments supplied to AddDataSeries() should be hardcoded and NOT dependent on run-time variables which cannot be reliably obtained during State.Configure (e.g., Instrument, Bars, or user input). Attempting to add a data series dynamically is NOT guaranteed and therefore should be avoided. Trying to load bars dynamically may result into an error similar to: Unable to load bars series. Your NinjaScript may be trying to use an additional data series dynamically in an unsupported manner."



    However, you would use BarsPeriod.BarsPeriodType and BarsPeriod.Value unless you are using a bar type that has underlying bars made from another bar type.
    Chelsea B.NinjaTrader Customer Service

    Comment

    Latest Posts

    Collapse

    Topics Statistics Last Post
    Started by CortexZenUSA, Today, 12:53 AM
    0 responses
    1 view
    0 likes
    Last Post CortexZenUSA  
    Started by CortexZenUSA, Today, 12:46 AM
    0 responses
    1 view
    0 likes
    Last Post CortexZenUSA  
    Started by usazencortex, Today, 12:43 AM
    0 responses
    5 views
    0 likes
    Last Post usazencortex  
    Started by sidlercom80, 10-28-2023, 08:49 AM
    168 responses
    2,265 views
    0 likes
    Last Post sidlercom80  
    Started by Barry Milan, Yesterday, 10:35 PM
    3 responses
    11 views
    0 likes
    Last Post NinjaTrader_Manfred  
    Working...
    X