Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Recovering from crash

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

    Recovering from crash

    Hi!

    I am trying to figure out how to handle crash recovery. Suppose, as my situation today is, that I have some running strategy and NT crashes while the strategy has an open position. I am using IB, so when I restart NT and reconnect to IB, NT actually knows about my orders and positions with IB (you can see them in the control center).

    As per a post by NT staff, a strategy would not know about the fact that the position is its own position, and indeed, the control center orders tab does not show the strategy on the open stop order, does not show the position on the strategies tab, confirming that the connection between the position, the orders and the strategy is entirely lost.

    However, if we maintain the assumption that I have at most one strategy active per symbol (this is something that I can control), then theoretically, the strategy can scan the account positions and discover the existing position and decide to manage it going forward. I don't know whether I can somehow discover the open stop order, as the Orders collection has nothing in it.

    So these are my questions (under the assumption listed above):
    1. Is there any way for a strategy to recover open (working) orders from the account?
    2. Is there any way that a strategy, having discovered a position, can "take it over"? That is to say, can it reestablish the connection between the position and the strategy. so that the managed API will do the right thing? (it is my understanding that is I simply issue an ExitLong() while having a "disconnected position" that was left over from the crashed process, then what the API will actually do is start a short position...
    3. Alternatively, can the strategy temporarily switch to an unmanaged mode, issue a Sell() when it wants to exit the "orphan position" and then return to managed mode so that further transactions will use the managed API as normal? Would that do "the right thing"?

    #2
    Hello arnonmoscona,
    Thanks for writing in and I am happy to assist you.

    1. The strategy can recover orders but only if it’s a 100% match.
    2. You can set Sync position true in the strategy parameter box to sync the account position and the strategy position. Please refer here to know more about sync position http://www.ninjatrader.com/support/h..._positions.htm
    3. Unfortunately you cannot mix Managed and Unmanaged code.

    Please let me know if I can assist you any further.
    JoydeepNinjaTrader Customer Service

    Comment


      #3
      Thank you. This is helpful. Can I get some further clarification though?

      1. Assuming the NT crashed or was otherwise terminated but I didn't touch the existing positions and working stops, and assuming that I configured NT like so: Immediately submit live working historical orders, Sync account position = true

      then should the match be successful even though some of the information (like the link to the strategy) was lost. I assume from what I read that the answer to this is "yes".

      2. Is there any way to set this combination programatically from the strategy (rather than interactively from the UI). I sometimes have lots of instances of the strategy (tens of them on multiple instruments). I realize that I have the alternative to code a single multi-instrument strategy, but that is more complicated and error prone than a single instrument strategy. It would work if I don't have to make manual (read: error prone) UI adjustments. So I prefer my current setup, as long as I can manage these settings from the code...

      Comment


        #4
        Hello arnonmoscona,
        1. Yes, as long as the order matches 100% (order price and quantity is same)

        2. Unfortunately there is no way to set it via code. You need to specify it when starting the strategy.

        Please let me know if I can assist you any further.
        JoydeepNinjaTrader Customer Service

        Comment


          #5
          Thanks.

          As for (2) I noticed that StrategyBase has a property SyncAccountPosition - I thought maybe I could set that in the Initialize method. Is this just undocumented stuff I should avoid?

          Comment


            #6
            Hello arnonmoscona,
            We only recommend assigning the value via the UI only.

            Please let me know if I can assist you any further.
            JoydeepNinjaTrader Customer Service

            Comment


              #7
              Oh, one more thing. If I had a partial fill of a stop, then I understand all bets are off. There is no chance for the strategy to sync the position properly. Am I correct?

              Comment


                #8
                Hello arnonmoscona,
                Yes, you are correct.

                Please let me know if I can assist you any further.
                JoydeepNinjaTrader Customer Service

                Comment

                Latest Posts

                Collapse

                Topics Statistics Last Post
                Started by Perr0Grande, Today, 08:16 PM
                0 responses
                2 views
                0 likes
                Last Post Perr0Grande  
                Started by elderan, Today, 08:03 PM
                0 responses
                5 views
                0 likes
                Last Post elderan
                by elderan
                 
                Started by algospoke, Today, 06:40 PM
                0 responses
                10 views
                0 likes
                Last Post algospoke  
                Started by maybeimnotrader, Today, 05:46 PM
                0 responses
                11 views
                0 likes
                Last Post maybeimnotrader  
                Started by quantismo, Today, 05:13 PM
                0 responses
                7 views
                0 likes
                Last Post quantismo  
                Working...
                X