Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Using DataSeries to store multi-time frame data

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

    Using DataSeries to store multi-time frame data

    Hello,
    I use both minute and daily bar data in my strategies/indicators. Due to the fact that minute bars are not split adjusted and daily is, I need to create a synthetic day close from the minute data (long story... this recommendation comes from NY support staff). So....

    It would be very beneficial if I could store the synthetic close data as a DataSeries (e.g. one synthetic daily data point per bar in the DataSeries). Since then I could pass the data series into existing/custom NT indicators. The problem (I hope I am wrong) is that when I define a new DataSeries that it contains the same number of data points / bars as the chart. So if I am using a 30 minute bar chart then it stores the same daily value 20 - 30 times each day, representing each 30 minute bar. In which case the data series is useless for any indicator since it doesn't represent the time series of synthetic daily closes, rather it represents a stair step.

    Is there any way to create a DataSeries that is consumable by existing NT indicators and that does not have the same number of bars as the chart? I believe that it must be possible since, for instance, Closes[1] would have a different number of bars than Closes[0] in a mult-time frame strategy.

    Best...

    #2
    joesandyego,

    Sure, this is possible.

    You could create a multi-timeframe indicator by adding a daily dataseries for the instrument to it. Then, you just check if BarsInProgress == 1 to ensure you are only updating on the daily series.

    Here is some more information on multi-timeframe indicators : http://www.ninjatrader.com/support/h...nstruments.htm

    Here is some more information on BarsInProgress : http://www.ninjatrader.com/support/h...inprogress.htm

    Alternatively you could use a time filter.

    Please let me know if I may assist further.
    Adam P.NinjaTrader Customer Service

    Comment


      #3
      I use multi-time frame quite a bit, but I am still confused by your suggestion so maybe I need to provide a little more detail. Because I use daily close data a lot, I need to create this synthetic daily close data on the fly without custom coding every indicator. Effectively, I just want to be able to find and replace 'Closes[1]' with 'SynthDay.DayClose' throughout my custom indicators and strategies (in this case Closes[1] would have been the DataSeries created by Add(PeriodType.Day,1) and SynthDay.DayClose is a custom indicator that passes back a DataSeries that contains the synthetic daily closes at daily intervals, not the intervals of the chart which is minute bars).

      So for instance, my 10 minute bar strategy needs to calculate the 10 day SMA of the synthetic Daily Closes. Then I would need to use:
      SMA( SynthDay(BarsArray[0]).DayClose , 10) instead of SMA(Closes[1], 10);

      Now I thought that maybe I could use:

      SMA( SynthDay(BarsArray[1]).DayClose , 10)

      and then in SynthDay use:

      Add(PeriodType.Minute,1)

      and in my indicator that calls SynthDay use:

      Add(PeriodType.Day,1)

      to calculate my synthetic day closes, but I believe this creates timing issues with CalculateOnBarClose since I enter SynthDay with a daily data series but then need it to regress to minute data via Add (e.g. when using historical data it may think that it knows data that it doesn't yet).

      Comment


        #4
        I proceeded per my last post and it seems to work fine. However, please do let me know if there is any problem with passing a Day dataseries to an indicator which then in turn Adds and Minute dataseries for the instrument and then the indicator processes using both the daily and minute timeframes. As I said, my only concern is that it will behave differently using historical data than live.

        Comment


          #5
          joesandyego,

          So is this indicator specifically to get synthetic daily data, or is it to use this to adjust minute data?

          Using a multi-timeframe strategy and indicator-of-indicator approach to get the synthetic daily data is a pretty good work around in my opinion.

          Essentially I was saying you could check in this indicator if BarsInProgress == 1 (which should be only when the daily series is being updated if its the only other data series added to the multi-timeframe indicator) you update the data series that stores the synthetic daily data. This ensure the data series doesn't have a bunch of extra same-value entries.

          I am not sure by your previous post what you are attempting to do since you are adding a minute series to something (I believe) you were using to get synthetic daily data.
          Adam P.NinjaTrader Customer Service

          Comment


            #6
            Hi Adam,
            The indicator is used strictly to get synthetic daily bars. In the indicator I use the value of the minute bar to get the daily close using PriorDayOHLC. The real test is after I insert this into all of my strategies and indicators and then do back testing to see: A) How big of a change in P/L due to difference between synthetic and actual daily closes and also B) system performance since I am calculating this on the fly each time I need daily bars which is a lot
            Best

            Comment


              #7
              joesandyego,

              It appears like it may be working judging by your previous post.

              Please let us know if you require additional assistance.
              Adam P.NinjaTrader Customer Service

              Comment

              Latest Posts

              Collapse

              Topics Statistics Last Post
              Started by argusthome, Yesterday, 10:06 AM
              0 responses
              18 views
              0 likes
              Last Post argusthome  
              Started by NabilKhattabi, 03-06-2026, 11:18 AM
              0 responses
              17 views
              0 likes
              Last Post NabilKhattabi  
              Started by Deep42, 03-06-2026, 12:28 AM
              0 responses
              14 views
              0 likes
              Last Post Deep42
              by Deep42
               
              Started by TheRealMorford, 03-05-2026, 06:15 PM
              0 responses
              9 views
              0 likes
              Last Post TheRealMorford  
              Started by Mindset, 02-28-2026, 06:16 AM
              0 responses
              38 views
              0 likes
              Last Post Mindset
              by Mindset
               
              Working...
              X