Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Secondary Data Series question. Use Chart Trading Hours?

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

    Secondary Data Series question. Use Chart Trading Hours?

    Hi,

    I want to be able to control how many bars to load on secondary data series.

    I only found one syntax that allows for "barToLoad":

    AddDataSeries(string instrumentName, BarsPeriod barsPeriod, int barsToLoad, string tradingHoursName, bool? isResetOnNewTradingDay)

    I want it to copy the chart's instrumentName and tradingHoursName.

    I've used Instrument.MasterInstrument.Name for string instrumentName.
    Is there a similar code to grab the chart's currently selected tradingHoursName?

    p.s. question, the isResetOnNewTradingDay code, how exactly does that opperate?

    Thanks!

    #2
    Hello davydhnz,

    Thank you for your post.

    If you want the instrument and the trading hours to be the same on the added data series, you can use null for the values.

    IsResetOnNewTradingDay indicates if the bars series is using the Break at End Of Day data series property.



    Please let us know if you have any other questions.

    Comment


      #3
      NinjaTrader_Gaby

      I tried that

      AddDataSeries(null, (BarsPeriodType.Minute, 1440), 2, null, false);

      but how do I set Minute and period 1440?

      I want only load 2 bars

      Thank you.

      Comment


        #4
        Nevermind, I worked it out ‍*facepalm*
        Code:
        AddDataSeries(null, new BarsPeriod { BarsPeriodType = BarsPeriodType.Minute, Value = 15 }, 2, null, false);
        Thanks Gaby

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by CarlTrading, 03-31-2026, 09:41 PM
        1 response
        47 views
        0 likes
        Last Post NinjaTrader_ChelseaB  
        Started by CarlTrading, 04-01-2026, 02:41 AM
        0 responses
        22 views
        0 likes
        Last Post CarlTrading  
        Started by CaptainJack, 03-31-2026, 11:44 PM
        0 responses
        33 views
        1 like
        Last Post CaptainJack  
        Started by CarlTrading, 03-30-2026, 11:51 AM
        0 responses
        50 views
        0 likes
        Last Post CarlTrading  
        Started by CarlTrading, 03-30-2026, 11:48 AM
        0 responses
        42 views
        0 likes
        Last Post CarlTrading  
        Working...
        X