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

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.
    JesseNinjaTrader Customer Service

    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.
        JesseNinjaTrader Customer Service

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by algospoke, Yesterday, 06:40 PM
        2 responses
        23 views
        0 likes
        Last Post algospoke  
        Started by ghoul, Today, 06:02 PM
        3 responses
        14 views
        0 likes
        Last Post NinjaTrader_Manfred  
        Started by jeronymite, 04-12-2024, 04:26 PM
        3 responses
        45 views
        0 likes
        Last Post jeronymite  
        Started by Barry Milan, Yesterday, 10:35 PM
        7 responses
        22 views
        0 likes
        Last Post NinjaTrader_Manfred  
        Started by AttiM, 02-14-2024, 05:20 PM
        10 responses
        181 views
        0 likes
        Last Post jeronymite  
        Working...
        X