Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

multiple instruments in sync?

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

    multiple instruments in sync?

    Hello. I'm running a strat where the primary instrument (ES) trades essentially 24 hours, but the secondary is only open during regular market hours.

    If I refer to them OnBarUpdate, are the times effectively in sync, even though the number of data points is different? The additional instruments are shown below, and in this case the VIX is the one that trades in different hours.

    else if (State == State.Configure)
    {
    AddDataSeries(Data.BarsPeriodType.Minute, 5);
    AddDataSeries("^VIX", Data.BarsPeriodType.Minute, 5, Data.MarketDataType.Last);
    AddDataSeries("ZN 06-18", Data.BarsPeriodType.Minute, 5, Data.MarketDataType.Last);
    AddDataSeries("RTY 06-18", Data.BarsPeriodType.Minute, 5, Data.MarketDataType.Last);



    }

    Thanks

    #2
    Hello stewarco,

    Thank you for the post.

    I am not certain I fully understand your question here. Are you asking why the bars are in sync?

    I see that you have used the same timeframe for all the secondary instruments, assuming they all are within their trading hours and have fast updates they will likely close bars very close together. Is this what you are seeing and questioning?

    I look forward to being of further assistance.

    Comment


      #3
      clarification

      Sorry. I'm not particularly concerned if they're in sync to the nearest second. What I meant was suppose if one instrument A trades 24 hours a day, and the other instrument B 8 hours a day, and i'm looking at hourly data points. At the end of the first day, instrument 24 will have 24 data points, and instrument B will have 8 data points. At the end of two days, instrument A will have 48 data points, and instrument B will have 16 data points. I just want to clarify that the data points are matched up by actual time, and not data point number (in which case the 24th data point for instrument B will match up with a date two days earlier for instrument A).

      Hope this makes sense.

      Comment


        #4
        Hello stewarco,

        Thank you for the post.

        Yes, time is used when building the data you see. You can create a chart with the two instruments using their respective sessions to see how the data will be formed specifically.

        In realtime, your code would be called for each of the data points based on the Calculate setting. When a tick closes a bar your code will be code if you are using OnBarClose. In your example, if you have 8 bars built your code would be called 8 times as the bars close.

        In historical the time is still used but the data points are all processed before entering realtime, you can see a visual of how data is processed for multiple series in code here: https://ninjatrader.com/support/help...%2Bare%2Bbuilt

        You can also use Prints to further debug how the script is processing the incoming data to help your understanding of how the platform is calling the script.

        I look forward to being of further assistance.

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by Geovanny Suaza, 02-11-2026, 06:32 PM
        0 responses
        571 views
        0 likes
        Last Post Geovanny Suaza  
        Started by Geovanny Suaza, 02-11-2026, 05:51 PM
        0 responses
        330 views
        1 like
        Last Post Geovanny Suaza  
        Started by Mindset, 02-09-2026, 11:44 AM
        0 responses
        101 views
        0 likes
        Last Post Mindset
        by Mindset
         
        Started by Geovanny Suaza, 02-02-2026, 12:30 PM
        0 responses
        548 views
        1 like
        Last Post Geovanny Suaza  
        Started by RFrosty, 01-28-2026, 06:49 PM
        0 responses
        549 views
        1 like
        Last Post RFrosty
        by RFrosty
         
        Working...
        X