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

Strategy AddDataSeries - Offset DataSeries

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

    Strategy AddDataSeries - Offset DataSeries

    NT Team,

    Extending from your example Multi-Time Frame & Instruments - How bars data is referenced, is it possible to "offset" added DataSeries?

    In your example, the Primary DataSeries is 1min and the Secondary DataSeries is 3min. Bars in the Secondary DataSeries end on Bars 3, 6, and 9. In the attached picture, BarsArray 2.

    Is it possible to "offset" added Data Series such that Bars end on Bars 4, 7, and 10. Or alternatively, such that Bars end on Bars 5, 8 and 11. In the attached picture, BarsArrays 3 and 4 respectively.

    Should it be possible, would any complications arise at End of Day (EOD)?

    Shannon
    Attached Files

    #2
    Hello Shansen,

    Thank you for your post.

    Offsetting the bar reference here would not be possible. Each minute based bar type will start at the same time at the beginning of the data loaded. Therefore the 3 minute will end on every 3 minutes, 5 minute on every 5 minutes and so on. There is no means to offset this.

    Please let me know if you have any questions.

    Comment


      #3
      Patrick,

      Thank you for your reply.

      Revisiting this query, I noticed the original "explanatory" diagram was incorrect.
      To cover off, with a corrected diagram (attached),
      Is it possible to "offset" added Data Series such that Bars end on Bars 4, 7, and 10. Or alternatively, such that Bars end on Bars 5, 8 and 11. In the attached picture, BarsArrays 3 and 4 respectively.
      For example where the Primary DataSeries is 5min, and the Secondary DataSeries is 15min:
      - Primary DataSeries Bar concludes at 11:05am, 11:10am: and 11:15am, etc.
      - Secondary DataSeries Bar concludes at 11:15am covering the period (11:00am - 11:15am), etc,
      - Tertiary DataSeries (offset) Bar concludes at 11:20am covering the period (11:05am - 11:20am), etc,
      - Quaternary DataSeries (offset) Bar concludes at 11:25am covering the period (11:10am - 11:25am), etc.


      Thanks again
      Shannon
      Attached Files
      Last edited by Shansen; 10-08-2017, 06:44 PM.

      Comment


        #4
        Hello Shansen,

        Thank you for your response.

        Each bar begins at the start of the first available historical data as requested from the 'Load data based on' setting in the Data Series menu and the 'Days to load', Bars to load', or 'Custom range' setting. The Trading Hours template (Session Template in NinjaTrader 7) will dictate the start of the first bar on the first day it is available.

        What this means in a 5 minute bar will close 5 minute after the start of the session and a 15 minute bar will close 15 minute minutes after the start of the session. Therefore each preceding bar will close 5 or 15 minutes respectively after.

        With that said you could create a new Trading Hours template for the added series you wish to offset that started however many minutes you need after the primary instruments session start.

        For example I created a Trading Hours Template based on the 'CME US Index Futures ETH' but it starts 3 minutes after the original. I then added this Trading Hours template in a 5 minute bar to my strategy and added it to a 5 minute chart of the same instrument that using the default 'CME US Index Futures ETH' template.

        Attached is a screenshot of the Trading Hours Template I edited and below you will find the code I used to test.
        Code:
        			else if (State == State.Configure)
        			{
        				AddDataSeries("ES 12-17", new BarsPeriod { BarsPeriodType = BarsPeriodType.Minute, Value = 5 }, "TestOffset");
        			}
        		}
        
        		protected override void OnBarUpdate()
        		{
        			Print("");
        			Print(BarsInProgress);
        			Print(Times[0][0]);
        			Print(Times[1][0]);
        		}
        Please let me know if you have any questions.
        Attached Files

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by maybeimnotrader, Today, 05:46 PM
        0 responses
        6 views
        0 likes
        Last Post maybeimnotrader  
        Started by quantismo, Today, 05:13 PM
        0 responses
        6 views
        0 likes
        Last Post quantismo  
        Started by AttiM, 02-14-2024, 05:20 PM
        8 responses
        166 views
        0 likes
        Last Post jeronymite  
        Started by cre8able, Today, 04:22 PM
        0 responses
        8 views
        0 likes
        Last Post cre8able  
        Started by RichStudent, Today, 04:21 PM
        0 responses
        5 views
        0 likes
        Last Post RichStudent  
        Working...
        X