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

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.
    Gaby V.NinjaTrader Customer Service

    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 LiamTwine, Today, 08:10 AM
        0 responses
        2 views
        0 likes
        Last Post LiamTwine  
        Started by Balage0922, Today, 07:38 AM
        0 responses
        5 views
        0 likes
        Last Post Balage0922  
        Started by JoMoon2024, Today, 06:56 AM
        0 responses
        6 views
        0 likes
        Last Post JoMoon2024  
        Started by Haiasi, 04-25-2024, 06:53 PM
        2 responses
        19 views
        0 likes
        Last Post Massinisa  
        Started by Creamers, Today, 05:32 AM
        0 responses
        6 views
        0 likes
        Last Post Creamers  
        Working...
        X