Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Strategy with Bars From Different Sessions?

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

    Strategy with Bars From Different Sessions?

    I was wondering if it is possible to load bars with different sessions in a single strategy.

    I did not find any overload for the Add (Bar) function to do that. I noticed that the system pivot indicator does request bars for previous day (daily bars) and passes a session argument which in principle could be a specific session of interest.

    Alternatively, is there a way to create a class which implements the IDataSeries interface and hold the bars related to the specific session I am interested in? I can manually filter the bars in the strategy to create the new bar series but instead of storing it in arrays, I would like to store it in a class which implements IDataSeries so existing indicators can be used.

    The context here is RTH indicators (& trading) with some indicators running 24/7. The chart of course is a 24/7 chart to keep the 24/7 indicators current.

    I could of course store the bar information in an array but then will have to rewrite the indicators to accept arrays. Alternatively I could replace the non-active bars with null in the data-series (.Reset ?) but the indicators will be have to be modified to skip the null data-values.

    Is there a workaround possible which does not require significant recoding?

    #2
    Hi aviat72, unfortunately not - the session template used for the strategy is designated at startup for the primary series it's using, you would then need to for example run on Default 24 / 7 template to have access to all data and the filter internally as needed for the indicator calcs.

    Comment


      #3
      Thanks Bertrand.

      Is there anyway to package the filtered data so that existing indicators can be reused? Essentially is there a way to create an object which implements an IDataSeries interface?

      class FilteredDataSeries{
      DataSeries mainSeries;
      SomeKindofArray indexRedirect;

      .....

      }
      With the [] operator overloaded so that FilteredDataSeries[index] is mainSeries[indexRedirect[index]]

      Comment


        #4
        aviat72,

        Unfortunately this is beyond the level of programming support we can offer. I am not sure what you mean by repackaging an indicator. Indicators by default are already tied to a Bars series. You cannot tie it an artificially filtered Bar series.
        Josh P.NinjaTrader Customer Service

        Comment


          #5
          Josh:

          What I am looking for is a way to call existing NinjaTrader indicators with the custom DataSeries I create. One option was to create a data-structure which complies with the IDataSeries interface.

          My custom-data series is tied to bars but is filtering a few out. The filtered regions will be continuous; i.e. they will represent sessions derived out of the 24/7 template (e.g. RTH from a 24/7).

          I can always rewrite the indicators I need in my strategy class using something like an array to pass the arguments. This will do the computation out of the context of the bars and on pure data streams.

          But is there a way to avoid the rewrite of indicators? All we need to do is add one level of indirection to the [] operator.

          Comment


            #6
            aviat72, unfortunately the NT indicators would be tied to bars series, so I believe you would need to rewrite the indicator calculations to without those for working on your custom / filtered data stream.

            Comment

            Latest Posts

            Collapse

            Topics Statistics Last Post
            Started by Geovanny Suaza, 02-11-2026, 06:32 PM
            0 responses
            599 views
            0 likes
            Last Post Geovanny Suaza  
            Started by Geovanny Suaza, 02-11-2026, 05:51 PM
            0 responses
            344 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
            558 views
            1 like
            Last Post Geovanny Suaza  
            Started by RFrosty, 01-28-2026, 06:49 PM
            0 responses
            557 views
            1 like
            Last Post RFrosty
            by RFrosty
             
            Working...
            X