Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Indicator calculated based on modified session

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

    Indicator calculated based on modified session

    Hello,

    Would it be possible to use AddDataSeries the following way:

    AddDataSeries(instrumentName, BarsPeriodType.Day, 1, MySession)

    Where "MySession" would be a session I would define in the Trading Hours menu ?

    In the following AddDataSeries calls, I did not see my option

    AddDataSeries(string instrumentName, BarsPeriodType periodType, int period)
    AddDataSeries(string instrumentName, BarsPeriodType periodType, int period, MarketDataType marketDat aType)
    AddDataSeries(string instrumentName, BarsPeriod barsPeriod)
    AddDataSeries(string instrumentName, BarsPeriod barsPeriod, string tradingHoursName)
    AddDataSeries(string instrumentName, BarsPeriod barsPeriod, string tradingHoursName, bool? isResetOn NewTradingDay)
    AddDataSeries(string instrumentName, BarsPeriod barsPeriod, int barsToLoad, string tradingHoursName, bool? isResetOnNewTradingDay)
    AddDataSeries(string instrumentName)

    The reason I am asking this is because i want to calculate daily indicators based on a modified session (shorter than the default) and use those indicators to trade during that sesssion.
    So essentially, the chart is an intraday chart, an I want to include on my chart (and strategy) the daily modified indicator.

    Thanks for any response/help you will be able to provide

    Regards

    #2
    Hello guilhem,

    Thanks for your question.

    You can use the following overload and create your own BarsPeriod object to pass the method.

    Code:
    AddDataSeries(string instrumentName, BarsPeriod barsPeriod, string tradingHoursName)
    BarsPeriod - https://ninjatrader.com/support/help...barsperiod.htm

    I.E.

    Code:
     AddDataSeries("AAPL", new BarsPeriod { BarsPeriodType = BarsPeriodType.Minute, Value = 1440 }, "US Equities RTH");
    "MySession" can be your own custom Trading Hours template.

    Please note that Trading Hours templates will not filter the data of a daily bar since the data provider will give their OHLC values for the daily bar from their daily data. You could use a 1440 minute series with your own Trading Hours template to create a custom daily bar, though.

    We look forward to assisting.

    Comment


      #3
      Hello Jim,

      Thanks for your reply.
      If I understand well, if i want to use a bar going from 10 AM to 7 PM for example (9 hours or 540 mins) I would need to first, create the trading session.
      Then i would need to do the following:

      AddDataSeries("AAPL", new BarsPeriod { BarsPeriodType = BarsPeriodType.Minute, Value = 540 }, "MySession");

      Is this correct ?

      Thanks

      Comment


        #4
        Hello guilhem,

        If you would like one bar for that day, I would suggest using 1440 minute bars with your custom Trading Hours template. If you are looking to build more bars in a day then I would suggest using lesser values than 1440 for value.

        Your understanding for using the Trading Hours template and AddDataSeries is correct.

        Comment


          #5
          Thanks. I have done a few test and it works perfectly !

          Comment

          Latest Posts

          Collapse

          Topics Statistics Last Post
          Started by Geovanny Suaza, 02-11-2026, 06:32 PM
          0 responses
          596 views
          0 likes
          Last Post Geovanny Suaza  
          Started by Geovanny Suaza, 02-11-2026, 05:51 PM
          0 responses
          343 views
          1 like
          Last Post Geovanny Suaza  
          Started by Mindset, 02-09-2026, 11:44 AM
          0 responses
          103 views
          0 likes
          Last Post Mindset
          by Mindset
           
          Started by Geovanny Suaza, 02-02-2026, 12:30 PM
          0 responses
          556 views
          1 like
          Last Post Geovanny Suaza  
          Started by RFrosty, 01-28-2026, 06:49 PM
          0 responses
          554 views
          1 like
          Last Post RFrosty
          by RFrosty
           
          Working...
          X