Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Problem with Account Synchronisation trading daily bars

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

    Problem with Account Synchronisation trading daily bars

    Hello,

    I am currently dealing with the following issue: I am trading a strategy using daily bars, where I hold positions over several days.

    My problem is the following: Since I am trading over IB it can happen that IB TWS shuts down and my strategies are disabled automatically. When I reconnect to IB TWS once again and enable my strategies I cannot reproduce my old position size and get wrong new positions sizes.

    My position size in real-time trading is calculated based on My Trading Equity available through IB (GetAccountValue ()). However this works only in real-time. When I enable my strategies once again after a shutdown of TWS some days later the bar, where my original real-time order got produced is already historical and I cannot use GetAccountValue anymore. In my logic a simulated equity value (calculated by the logic) is then used instead.

    The consequence is that the positionsize between my strategy and my account does not match anymore. Since I am using SyncAccount = True; immidiately submit orders my Account gets always updated with the new orders produced by the strategy.

    Any ideas how I can handle this when I get one of those interruptions through IB??

    Thx,
    Peter

    #2
    Hello,

    Only workaround I could suggest would be instead of using GetAccountValue, you track it yourself in your own strategy. This way the numbers always add up and the values are the same.

    Let me know if I can be of further assistance.

    Comment


      #3
      What do you mean by tracking it yourself, please be a little bit more precise. Of course I could track it within a variable, but then I would also loose the IB equity values, when the strategy is disabled.

      The only thing, which comes to my mind is writing it away into files, which is not elegant and complicated in detail. Any other proposals?
      Last edited by unter821; 01-13-2011, 02:59 PM.

      Comment


        #4
        Hello,

        Unfortunately no other purposels that I can think of. As your adding a dynamic value here that will calculate each time the strategy is enabled. It needs to be either a static variable for size you specify yourself when you start the strategy, or accept the increased position size due to the increased account size on restart of the strategy.

        My idea of tracking it yourself, would be to use a time filter to run GetAccountValue in the morning once each day. Then write this to a text file and if the strategy trades get this account size QTY from the .txt file for the rest of the day this way the account QTY check is done once at the start of the day and stays the same the rest of the day.

        Let me know if I can be of further assistance.

        Comment


          #5
          Hello,

          I have implemented a workaround via files, will test it tommorrow, should work, thanks for your ideas.

          Another question to the account synchronisation with IB: When I enable strategies for which IB already holds positions it happens from time to time that new stop orders are placed. Meaning that I have than 2 completely identical stop orders for one position, which of course does not make sense!! Does the account synchronisation not work for stop orders?

          How can I prevent NT from placing redundant stop orders?

          Thx, Peter

          Comment


            #6
            Hello there, I will have Brett get back to you tomorrow.
            AustinNinjaTrader Customer Service

            Comment


              #7
              Hello,

              This should work as I have tested it. Would need to have you report in a specific case where this occured so that I can look into log and trace files. The only way this would not work is if your strategy calculated different stop levels and entries on its second run when being reenabled. Which should be pretty much resolved with the fix you just put in.

              Let me know if I can be of further assistance.

              Comment


                #8
                Correct it should not happen and the strange thing is that the stoplevel is exactly the same. It happened for all 6 instruments, where the strategy is currently put on for January. I will send you the log and trace files of yesterday by mail and you could for example check the NQ (Nasday Future).

                Comment


                  #9
                  Hello,

                  I will follow up with you on your issue via email.

                  I look forward to assisting you further.

                  Comment


                    #10
                    Still getting stop orders a second time

                    Hello,

                    Due to some days off I had closed down Ninja, but kept the positions on at IB. Today, when I reenabled and synchronised my strategies I got for some markets (interestingly not for all) the stop orders produced once again. So I am ending up with the correct stop order, but 2 times. A message indicates, that some reference to IB order is missing.

                    Peter
                    Attached Files

                    Comment


                      #11
                      Hello,

                      Did you make any modifications to the stops during this time Ninja was not connected? As it seems like this may hve occured?

                      I look forward to assisting you further.

                      Comment


                        #12
                        No, I did not make any modification to the stops. The only thing I do manually in IB is, that I delete those double stops. But that's already after the problem occured.

                        Comment


                          #13
                          Peter, can you please attach your log / trace files from the day of the issue or submit them to support so we can review them? Are you working with TWS 911 and NT7 R2?

                          Thanks
                          BertrandNinjaTrader Customer Service

                          Comment


                            #14
                            Hi Bertrand,

                            Yes I am working with TWS 911 and NT7 R2.
                            Have attached log&trace file.

                            Thx
                            Attached Files

                            Comment


                              #15
                              Thanks Peter, I'm not seeing anything largely incorrect, except this one here -

                              2011-02-08 18:33:01:295 in OnUnhandledThreadException
                              2011-02-08 18:33:01:388 ********* exception trapped *********
                              2011-02-08 18:33:01:388 Error in custom data filter: Convert(...) throws an exception. Inner exception is: Instrument name 'RT 03-11' does not refer to a valid NinjaTrader instrument

                              Where were you using the RT 03-11 instrument?

                              Would you mind uploading your DB file for analysis via our Help > Mail to Support tool?

                              Thanks in advance,
                              BertrandNinjaTrader Customer Service

                              Comment

                              Latest Posts

                              Collapse

                              Topics Statistics Last Post
                              Started by sgordet, Today, 06:04 AM
                              0 responses
                              1 view
                              0 likes
                              Last Post sgordet
                              by sgordet
                               
                              Started by bc24fl, 08-30-2019, 01:58 PM
                              4 responses
                              259 views
                              0 likes
                              Last Post PaulMohn  
                              Started by sugalt, Today, 04:02 AM
                              0 responses
                              6 views
                              0 likes
                              Last Post sugalt
                              by sugalt
                               
                              Started by tradingnasdaqprueba, 04-09-2024, 09:52 AM
                              6 responses
                              30 views
                              0 likes
                              Last Post tradingnasdaqprueba  
                              Started by PaulMohn, Today, 02:06 AM
                              1 response
                              9 views
                              0 likes
                              Last Post PaulMohn  
                              Working...
                              X