Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Multi-Instruments Synchronization

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

    Multi-Instruments Synchronization

    Hi,

    I'm developing a multi-instrument strategy and I fount that there is a problem when going from historical data to real-time in the synchronization between the instruments.
    For example in my code I use the line
    Code:
     if (BarsInProgress != 0) return;
    because I want the calculation to happen only once but the issue in real-time that the data series are not in sync. what I mean is that BIP0 has the last value but BIP3 didn't receive yet the Bar Close event and is data series is not currently update with BIP0.
    Is there a way to guaranty that all BIPs are in sync. with the most updated data?

    Thanks in advance!

    #2
    freewind, to ensure all bar series are up to date, you will need to check the largest timeframe:
    Code:
    if (BarsInProgress == 3)
    // do something
    Another alternative would be to use CalculateOnBarClose = false, and all series would always be up to date.
    AustinNinjaTrader Customer Service

    Comment


      #3
      I tried your first suggestion and I'm not sure it is working.For example in a scenario when the first BIP0 get an event(quote) every 5 sec and BIP1 get an event every second then BIP1 will be trigger before BIP0, am I correct?
      Your second option will be too cpu consumption because I'm using up to 100 instruments.

      Comment


        #4
        Hello,

        It would update as follows.

        BIP0
        BIP1
        BIP1
        BIP1
        BIP1
        BIP1
        BIP0
        BIP1
        BIP1
        BIP1
        BIP1
        BIP1
        BIP0

        for example.
        BrettNinjaTrader Product Management

        Comment


          #5
          Thanks Brett, so my observations are correct.
          Can you suggest a way to sync. between all the BIPs so I'll be sure they all got the last data.
          I'm comparing percentage moves between many BIPs evry few minutes so being in sync. is critical.

          Comment


            #6
            Hello,

            Can you clarify on being sync? As the process below never changes and will always be in sync.

            I look forward to assisting you further.
            BrettNinjaTrader Product Management

            Comment


              #7
              The process never change but the sequence real time quotes get to my PC is not predetermine so if I check for BIP0 it happens that BIP20(for example quote didn't arrive and when I check Closes[20][0] I get the price 5 minute ago.

              Comment


                #8
                Hello,

                Right this would be expected with current NinjaTrader design. As its working at getting the correct value for that bar which is updated when the BIP updates. If the BIP 20 didnt update 5 minutes ago then that's its value and will remain its value until the next bar and is technically correct. Which is either every 5 minutes or every tick depending on what COBC setting you are using.

                You are trying to mix realtime quotes with COBC true it seems and you will run into issue doing this. You would need to run COBC false to get the realtime bar updates.

                Your only last option is to try to play around with this method to get what you need however this would be advanced use and unsupported.

                BrettNinjaTrader Product Management

                Comment

                Latest Posts

                Collapse

                Topics Statistics Last Post
                Started by argusthome, 03-08-2026, 10:06 AM
                0 responses
                88 views
                0 likes
                Last Post argusthome  
                Started by NabilKhattabi, 03-06-2026, 11:18 AM
                0 responses
                48 views
                0 likes
                Last Post NabilKhattabi  
                Started by Deep42, 03-06-2026, 12:28 AM
                0 responses
                30 views
                0 likes
                Last Post Deep42
                by Deep42
                 
                Started by TheRealMorford, 03-05-2026, 06:15 PM
                0 responses
                34 views
                0 likes
                Last Post TheRealMorford  
                Started by Mindset, 02-28-2026, 06:16 AM
                0 responses
                68 views
                0 likes
                Last Post Mindset
                by Mindset
                 
                Working...
                X