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.

        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.

            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.

                Comment

                Latest Posts

                Collapse

                Topics Statistics Last Post
                Started by rene69851, 05-02-2024, 03:25 PM
                1 response
                20 views
                0 likes
                Last Post rene69851  
                Started by ETFVoyageur, Yesterday, 07:05 PM
                5 responses
                42 views
                0 likes
                Last Post ETFVoyageur  
                Started by jpeep, 08-16-2020, 08:31 AM
                13 responses
                487 views
                0 likes
                Last Post notenufftime  
                Started by realblubb, 04-28-2024, 09:28 AM
                2 responses
                32 views
                0 likes
                Last Post realblubb  
                Started by bmarovets, Today, 06:33 PM
                0 responses
                12 views
                0 likes
                Last Post bmarovets  
                Working...
                X